- URL:
- http://www.phpfreaks.com/blog/introducing-the-proem-framework
- Print Date:
- Dec 21, 2024 11:18:30 PM
Blog: Introducing the Proem Framework
- Views:
- 65111
I have been holding off on writing to much about Proem up until now only because it is still in the very early stages of development. It is however really starting to take shape and currently provides most of what people would expect from an MVC implementation. I say most because there is still a lot of work to be done, however, in the latest build 0.3.0 (just released) you can find all the usual suspects such as Request, Response, Routing and Controller components, as well as a simple Dispatch mechanism. Hell, you can even create a simple "hello world" application, which I will provide here as a quick example.
Proem has for the most part been an ongoing project of mine for the last couple of years. There have been several different incarnations of the project, but what is currently available on Github [https://github.com/proem/proem] started live about 4 months ago as a complete rebuild, when I started playing with PHP5.4's alpha releases.
Already there is a lot in the framework, but there is still plenty of work to be done. The key features of Proem are much like that you would expect in other modern MVC implementation. It supports easy object overloading via cascading namespaces [http://proemframework.org/docs/cascading-namespace.html], dependency injection [http://proemframework.org/docs/services-component.html] via a simple CI container mechanism, simple to configure routing [http://proemframework.org/docs/route-component.html] and the entire framework is event driven [http://proemframework.org/docs/signal-component.html] making it easy to extend.
One of the key goals of Proem was to make the bootstrap process [http://proemframework.org/docs/bootstrap.html] easy to understand.
Everything in Proem revolves around Events (or hooks) that can have Plugins, Modules or even just simple callback's attached to them. Of course a lot of these Events already trigger sain default actions, so to get up and running you don't really need to do very much.
Let's take a simple hello world example. Download the proem .phar from here [http://proemframework.org/downloads/proem.phar]. Create an index.php file:
<?php require_once 'phar://proem.phar'; (new \Proem\Autoloader) ->registerNamespace('Module', './lib') ->register(); (new \Proem\Proem)->init();
Create a directory structure to house our controller in:
mkdir -p lib/Module/Index/Controller
Now, within the Controller directory create a Hello.php file and place the following Controller code within it:
<?php namespace Module\Index\Controller; class Hello extends \Proem\Controller\Standard { public function world() { $this->assets->get('response')->appendToBody('<h1>Hello World!</h1>'); } }
Visting http://localhost/index/hello/world should produce a simple Hello World! page. Of course all these paths, and namespaces can be configured differently and you can make the url prettier by playing with the Router.
At this stage I have just finished releasing the third major milestone [https://github.com/proem/proem/compare/0.2.0...0.3.0] (0.3.0). The next milestone (0.4.0) has been set aside as a general maintenance release where I am going to audit the code base. Just clean up a few little things and try and make sure that everything is nice and consistent across the board. The Test suite is also going to undergo a complete refactor. I don't expect any major new features to be implemented during this next period.
A lot of work has been done within a pretty small timeframe up until now, and the code base could just do with a little bit of loving for the moment.
Once this clean up is complete however it will be full steam ahead toward a 0.5.0 release which should see the last of the main infrastructure in place, and from here, development will start on providing default plugins such as form handlers, ACL's and Session management.
If you think you can help out, please don't hesitate to get in contact. I am particularly interested in anyone with technical writing skills but am more than willing to help out any programmers who would like to get in on the ground level. More information is available on the main site: http://proemframework.org/contrib.html [http://proemframework.org/contrib.html]