Little PHP6 Framework

I’ve been working on a little PHP6 framework inspired by various other projects (Django, Ruby on Rails, Symfony, CakePHP, etc.). The aim is simple: write less crappy PHP code, and it seems to achieve that decently.

Currently there is no ORM, so it won’t be much use to database-centric sites.

Mostly, what it does now:

[list][]Routers, with regular expressions mapping to static (“view”) functions in classes called controllers. The named parameters in the URIPattern regexes are a lot of fun to play with, and are merged with the params given when called. It also supports nested routers, so there can be a nice hierarchy of things like “blog” and “polls.”
]Cleanly implemented “Response” and “Request” objects — all input and output can be controlled via these.
[]Hierarchical template system, allowing [font=monospace]extend[/font]ed templates, and included ones could also be easily implemented.
]Template contexts, allow a variable system in the templates without mangling the global namespace.
[]JSON configs, with sensible defaults
]Other small things … like handling exceptions and such nicely.[/list]

Try playing with it:

Some things to note when you’re just starting to play:

[list][]All URIs should be accessed with a prefix [font=monospace]site/[/font] after the site directory name — I’m still trying to think of the best way to do this, but I like this because it will allow the contents of the library and site to be outside the public directory and just point everything to the outside file…
]All requests start at [font=monospace]lib/dispatch.php?uri[/font].
[]Routers are defined by default in [font=monospace]app/routes.php[/font].
]The [font=monospace]app/[/font] and [font=monospace]lib/[/font] directories are intended to separate site-specific logic from the core “develop” (hmm, good name for the app?) framework. [font=monospace]lib/[/font] contains all the core stuff, but for now feel free to add stuff to it… just understand what you’re doing.
[*]All JSON config lookups are done by [font=monospace]ConfigLoader[/font]’s static methods, and always checks if the user has defined a value for the lookup first, and then resorts to the [font=monospace]lib/[/font] definition, if any.[/list]

It’s fun to play with … give it a shot. :smiley: