# Little PHP6 Framework

**URL:** <https://forum.kirupa.com/t/little-php6-framework/235932>\
**Category:** open source\
**Created:** [August 15, 2007, 8:58pm UTC](https://forum.kirupa.com/t/little-php6-framework/235932 "2007-08-15T20:58:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [August 15, 2007, 8:58pm UTC](https://forum.kirupa.com/t/little-php6-framework/235932/1 "2007-08-15T20:58:33Z")

</div>

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: [http://nokrev.com/dump/develop.zip](http://nokrev.com/dump/develop.zip)

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. 😃
