<nephtali>

A simple, flexible, fast, and security-focused PHP framework
Get Nepthali set up.

Overview

A general overview of Nephtali's architecture, general principles, and core components.

Architecture

Nephtali's maps on to existing sites without issue because it doesn't change the default routing of the server. You can use .htaccess to implement pretty URL's if desired, but pretty URL's aren't a focal point of Nephtali. Nephtali receives the markup for the PHP page after any PHP code directly embedded within the page has processed (that's why Nephtali plays nicely with legacy PHP code.) During processing, Nephtali:

  1. Loads nconfig.php, which contains the configuration settings (database connection details, etc.) for the dev, prod, and test modes of operation.
  2. Includes nregister.php, which is a convenient file for mapping processing across an entire site or by directory.
  3. Checks if a file within the nsite directory matches the path of the current request (e.g., if the current request is for the page http://yoursite.com/contact/index.php, then the file nsite/contact/index.php would match.) If there's a match, Nephtali includes the file (AKA, a code-behind file.)

General principles

Nephtali's development process hinged on the following principles:

  • Don't hide complexity, strive for simplicity

    Many web frameworks attempt to make things easier for the developer by hiding complex tasks. However, when you need to alter a complex task beyond the default, jumping in behind the scenes often proves to be daunting and error prone.

    In contrast, Nephtali was developed through many, many iterations of refactoring geared towards simplification. In the end, Nephtali's core API now fits within one file, is high performance, and capably powers a broad range of web sites. While using Nephtali, you'll find that you're in control throughout the flow of the application.

  • Embrace functional programming

    PHP is certainly no functional language, but the new features in PHP 5.3 allow Nephtali to embrace functional principles where possible. Nephtali makes use of immutable values, tries to avoid functions with side-effects, and there are no classes within the entire framework.

    What's this buy you? Well, functional programming tends to be easier to debug, easy to test, and promotes parsimony in your code base.

  • Stay out of my markup

    Nephtali keeps all application code cleanly separated from the markup for the site, freeing designers, front-end developers, information architects, and UX professionals from having to worry about breaking something or having to redo work when the site moves beyond a prototyping stage. All pages can be used as-is by Nephtali after adding a few XML comments.

  • Security is not an add-on

    Systems that value security must allow security considerations to inform every step of the design process.

Core components

Nephtali makes use of a few basic components to process any page.

  • Ports

    All incoming Get, Post, Cookie, and File values are validated by ports. A port automatically checks the value(s) received against the expected properties (length, type, etc.)

  • Pipes

    Dynamic regions within pages are rendered through pipes. Pipes determine the view to be displayed and carry out any necessary databinding.

  • Outputs

    For simple fields of text that don't require a full-fledged pipe, outputs allow you to databind a simple value.

  • Vals

    Vals provide easy access to a store that perserves immutability.

blog comments powered by Disqus