NeoFW

From NarcWiki

Jump to: navigation, search

NeoFW is a framework for writing web applications. It's not necessarily better than any other framework, however it provides a good place for me to keep and refine my personal code library. Ultimately, that's its major point: it's my code library, the best of my work.


Contents

What does it do?

As stated above, it's a framework for web applications. With a single include (okay, and a little bit of configuration), you can summon forth powerful functions that take much of the detail work out of the process, and allow you to concentrate on making the application do what you want it to do.

Obviously, this is no different from the other million or so such frameworks out there, but the devil's in the details: the learning curve is infinitely shorter (for me) because I'm the one who wrote it in the first place.

Also, it's infinitely more debuggable; and every change I make tends to make it better.


How does it work?

The framework is a series of .inc files dubbed modules, and driven by a master .inc, based on a series of configuration directives taken out of a $config array.

By default, most of the functionality is not included -- you need to request it using the right $config directive -- this is standardized to $config[module_name]['in_use'] = true.

What are the modules?

  • base -- this is the base module and the first of two absolutely required components. The base module provides the glue functions the rest of the framework uses to hold itself together, as well as a few misc functions that haven't found a place yet.
  • err -- the second required module, err provides error reporting and handling functions. This module also does double-duty as a centralized logging solution (which is why it's absolutely required).
  • db and db.* -- these modules provide a way to call in database-abstracting functions for your favorite PHP-accessible database. At the moment, this includes the null database driver (which provides nothing), and the mysql and mysqli drivers, which use the respective PHP driver of the same name.
  • priv -- provides privilege-handling and access control. This is one of the most complex modules to configure.
  • auth -- provides an authentication framework for applications that want to support user registration and login (which would be... almost all of them?). Also does double duty by providing a unique way to determine the correct name for any NeoFW table, and therefore required by most of the advanced functionality modules.
  • sess -- provides in-database session storage and cleanup. Because the default way to store sessions (flat files in /tmp) is just awful. The auth module relies on this one, so it will probably get included even if you don't request it outright.
  • prog -- the simplest module, provides a unique identifying ID for any NeoFW application.
  • tpl -- provides a simple but powerful templating system. Allows you to break the HTML away from the business end of the code.
  • val -- provides several validation functions (basically glorified regexes, really) for user input. Not very interesting.
  • fmt -- some formatting functions for various uses.
  • file -- provides a few interesting filesystem functions.
  • ua -- user agent functions. Includes redirect(), which tries to be a smart wrapper around header('Location:').
  • html -- some (X)HTML functions for simplifying frequently-repeated operations. For example, html_css_include() generates a correct <link rel="stylesheet"> tag for your favorite flavor of (X)HTML.
  • crumbs -- these functions help creation of a navigational 'breadcrumb' trail as seen on many many websites.
  • xml -- (experimental) support for XML construction through a single xml_tag() function. Potentially overridden by PHP's XML-DOM support.
  • event (also responds to events) -- allows defining events using an addEvent/callEvent model, whereby interested functions register themselves to fire on an event, and then hooks are added by firing the right events at the right times. Can probably be used to provide modular extensibility to applications by publishing a "hooks API" or similar.

In addition to these, there are a few "hidden" modules that cannot be included directly, but are called in by the modules for whom they provide functions.

What hidden modules are there?

  • admin -- is included by auth. Provides a very simplistic way to define privileges across applications. Probably superseded by priv, but still in use for its ability to declare someone an administrator of all NeoFW applications by giving them an admin_level above 90.
  • user -- also included by auth, provides the lower-level user-handling functions like creating, retrieving, updating and deleting users. The auth module is really a wrapper around this, together with a few session variables.

Any other hidden dependencies?

  • prog depends on auth because of the latter's ability to provide correct NeoFW table names. This may change in future. For now, be aware prog will die() if auth is not also included.

See Also

  • NeoFW Modules -- a page that lists the specifics of each module, including (especially) what config directives are available.
  • NeoFW Configuration Directives -- a listing of all the configuration directives available in NeoFW.

(Note: both pages above contain mostly the same information, but from different perspectives)

How do I get it?

You don't. NeoFW is still experimental and unfit for release. That it's good enough to drive the applications on narc.ro doesn't mean it's good enough for a mission-critical system. Try CakePHP, I've heard good things about it.

Retrieved from "http://wiki.narc.ro/a/NeoFW"
Personal tools
Stuff