#native_company# #native_desc#
#native_cta#

Meet PHPixie, a Lightweight PHP MVC Framework

By Josh Tucker
on January 15, 2013

The Model-View-Controller architecture pattern is currently dominating PHP web development. A multitude of different frameworks have been created following its guidelines, thus enabling developers to better structure their code and speeding up the whole development process. Although a lot of mature frameworks like Zend and CodeIgniter cover most of the functionality a PHP developer needs, they usually are slow to add cutting edge features because of their backwards compatibility requirements. That’s why many PHP developers have begun shifting from full-stack frameworks towards more minimalistic ones that allow more freedom and provide better performance for simple websites. PHPixie is one of those emerging tools.

PHPixie is a lightweight PHP MVC framework that employs a simplistic implementation of the request-response flow yet still enables the use of more complex architectures such as HMVC. PHPixie handles a lot of things differently from the full-stack frameworks. For example, most other frameworks that use an autoloader to load classes force a naming convention. So, you must put classes in folders according to their class names in such a way that a class inside /driver/mysql/query.php should be named Driver_Mysql_Query. PHPixie reverses that order so that the class name becomes Query_Mysql_Driver, resulting in much better readability because the first word of the class name actually describes the class better. This small change can greatly improve the source code presentation of large projects.

PHPixie’s straightforward architecture and small size allow it to have fast performance. The size of the framework matters the most for systems with limited resources, such as VPS, that utilize an opcode cacher like APC or XCache. Furthemore, PHPixie’s code replaces heavy, process-intensive functions like regular expressions with less obvious but faster counterparts.

Most lightweight PHP Frameworks don’t come with any means of database access abstraction, thus requiring the developer either to implement one or to use one of the more popular ORMs like Doctrine. PHPixie comes with its own query builder and ORM. ORM in particular relies heavily on convention over configuration to allow the developer to create a full-featured model without writing a schema or a single configuration file just by creating a single file with a properly named class. Some of these ideas were inherited from Kohana, another MVC framework that PHPixie originated from as a series of patches.

Perhaps the strongest attribute of PHPixie is its simplicity. Its creators claim that in just half an hour you can learn to code using PHPixie with no prior MVC experience. For this purpose, they’ve created a lighthearted 30-minute tutorial that gives a brief introduction to first time users. PHPixie likely won’t ever become one of the more popular frameworks, but it definitely will find its own userbase, particularly among advanced users who don’t like frameworks forcing themselves on them.