The third installment of our blog posts regarding the upcoming 0.5.0 version is about the MVC implementation. Below follows implementation concepts and examples of a MVC application using Phalcon 0.5.0.
As far as the MVC implementation is concerned, our main goal with 0.5.0, was to make it more flexible than ever, giving more control to the developer. Due to this, Phalcon is now able to load simple MVC applications and multi-module ones.
In addition to the dependency injection component seen in the previous post of the introduction series, a new component makes its appearance in Phalcon 0.5: the Events Manager. Its purpose is to intercept the execution of most of the components of the framework by creating “hook points”. These hook points allow the developer to obtain status information, manipulate data or change the flow of execution during the process of a component.
In the following example, we use the EventManager to listen for events produced in a MySQL connection managed by Phalcon\Db
. First of all, we need a listener object to do this. We create a class which methods are the events we want to listen:
Development in the new version of Phalcon 0.5.0 is well underway. In this new version we are introducing new components for the community to use. In the blog posts to follow, we will explain these new features in length.
With Phalcon 0.5.0 (still under development) we are introducing a new design pattern called Dependency Injection. In short, objects should not be instantiated inside a class, rather injected using constructors and/or setter methods. This pattern increases testability in the code, thus making it less prone to errors.
Following up on the 0.4.2 release a few weeks ago, we have a fresh update to address some issues and minor bugs.
We are also very excited to announce the release of the 0.5.0 alpha 1 version! This new branch offers many improvements and a huge refactoring of the framework. We are happy that the changes we have introduced have increased performance even more.
As we continue to enhance Phalcon with new functionality and features, we have migrated all of our documentation on Read the Docs, a service that hosts documentation for open source projects such as ours.
Utilizing this service allows for:
Our main goal is to make Phalcon a great framework that everyone can benefit from.
With that in mind, the 0.4.x branch was a great step forward and we are preparing for 0.5.x which will be a big redesign. The new branch will require some refactoring which we want to discuss with you. New changes will be introduced, big but necessary, which will affect the functionality of current applications.
We built Phalcon because we wanted a faster and better way to create web applications with PHP. Now we can’t imagine working without it. This time we’re releasing the first update to the 0.4.x branch. Phalcon 0.4.1 comes with interesting features described as follows:
Today, we’re launching another sample application for Phalcon. This time, we wanted to create an alternative version of the PHP site powered by the C-extension framework. This is the greatest example we have done until now, implementing many of the main framework features, especially the newly added: Multilingual Support and Complex Routing.