There are many PHP frameworks available for developers. Certainly the most famous are CodeIgniter, Symfony, Zend and CakePHP. But the problem with these frameworks is they are very heavy due to the large number of libraries contained and, often, they slow down development for less experienced users.
So once more, we got our investigation hat on and researched what are the best lightweight PHP frameworks out there right now.
We had only two criteria:
- Framework size does not exceed 1MB
- Framework has been updated at least since 2009
Read on to choose your next PHP framework. Make sure to check the comparison table at the end!
MicroMVC is a blazing fast Model View Controller framework in less than 150kb. It offers Model, Library, Controller, Function, and View management. Plus other features like URI Routing, hooks/plugins, file uploads, database abstraction, captcha creation, and more. If you are new the Model/View/Controller world of OOP – then this system is for you. Every line is documented and it is as simple of a system to tear-apart as you can get.
- PHP 5
- Apache mod_rewrite (or similar for other servers)
- PDO if using the Database
Condensed in a single 55KB file, the framework’s simple domain-specific language gives you access to Fat-Free’s all-purpose template engine, flexible cache, automatic spam protection, integrated unit testing tools, and code profiler. It’s so small and fast – it even has a bandwidth throttle for controlling Web server traffic. Fat-Free is also packaged with optional plug-ins that extend its capabilities.
- PHP 5.3+
- Apache mod_rewrite
Flourish has a modular architecture, meaning it isn’t strictly MVC. It focuses on being secure, well documented and easy to use, while solving problems intrinsic to web development. The most important features of this framework are the following:
- Consistent and easy to understand
- Works with international data
- Can perform accurate math calculations
- Easily manipulates images
- Able to run on different databases (MySQL, PostgreSQL, SQLite, MSSQL, Oracle, DB2)
- Can be used on closed-source projects
- Plays nicely with other libraries and frameworks
Another important feature is the download page. In fact, you can customize your download with the classes that you effectively need. In this way you can save more space on your server. It has excellent documentation, but unfortunately the package doesn’t contain files needed to install it. You must create them manually reading the guide.
- PHP 5.1+
- Needs to create configuration files
Konstrukt is a minimalistic framework which provides a foundation on which to build rather than a boxed solution to all problems. It focuses on the controller layer, and tries to encourage the developer to deal directly with the HTTP protocol instead of abstracting it away. Konstrukt uses a hierarchical controller pattern, which provides a greater level of flexibility than the popular routed front controller frameworks.
- Controllers are resources
- URI-to-controller-mapping gives your application a logical structure
- Routing based on logic rather than rules
- Nested controllers supports composite view rendering
- Embrace HTTP rather than hide it
- Enable the programmer, rather than automating
- Favour aggregation over code-generation or config-files
- Encourage encapsulation, and deter use of global scope
- Limit focus to the controller layer
- PHP 5
LightVC is a lightweight model-view-controller (MVC) framework without the model. This decoupling allows any model or object relation mapping (ORM) tool to be used, including none at all if one is not needed. As such, LightVC does not couple itself to any non-VC related classes either, such as those for managing sessions, form helpers, and so on. This promotes code reuse by allowing existing code for such tasks be used. The features are:
- Lightweight single-file view-controller framework
- Allows usage of any model or ORM
- Promotes code re-use
- Highly configurable
- PHP 5
6. Recess PHP
Recess is a RESTful PHP framework that provides a fun and enjoyable development experience for beginner and seasoned developers alike. If you want a full featured RESTful web application without having to master the command line or learn complicated deployment recipes, Recess is for you. Recess is fast, light-weight, and has a very small footprint—ideal for LAMP development and drag-and-drop deployment to shared hosts. Recess is a modern framework that uses a loosely-coupled Model-View-Controller architecture designed and optimized specifically for PHP 5.
- mod_rewrite suggested
- PHP 5.2.4 or greater
Adroit is a lightweight PHP 5 MVC framework that is geared towards helping you develop faster. The main motivation behind Adroit is to keep it simple, but provide useful features that developers want. Whether you’re just beginning web-application development, or a seasoned veteran, Adroit can help make that experience better. Adroit provides a lot for how lightweight it is. These are a few of the key benefits:
- Rapid development
- Eliminate repetitive tasks
- Familiar MVC architecture
- Object Oriented
- Simple DB persistence
- Utilizes Smarty Template Engine
- Simple and Manageable ajax development
- PHP 5
EpiCode is an extremely lightweight PHP framework. It includes caching, session, database, form validation, twitter, oauth and asynchronous/non-blocking curl components. EpiCode started off as an MVC framework but has evolved into a set of extremely useful tools. Every tool is completely decoupled so they can be used independently or in conjunction. Each library in EpiCode is thought out and implemented in an extremely cohesive manner.
- PHP 5
Tekuna is a compact framework for web-based applications. It provides a stable basis and a generic infrastructure for your projects. Tekuna has a very small footprint and will not pollute your codebase with unnecessary stuff. The most important features are:
- Component-oriented Definition of the Application
- Intuitive Routing of Actions to Controllers
- Friendly URLs with URI Routing
- MVC Architecure
- PHP Error handling with Exceptions (and thus catchable)
- Separate Request and Response Objects
- Strict Input Filtering
- Eliminating the Effects of Magic Quotes
- Full UTF-8 Support
- Support for multiple Template Engines
- Simple Multilanguage Support
- Apache with mod_rewrite
- PHP 5.2.1+
Vork is an open-source PHP framework designed for rapid development of performance-oriented scalable applications. The mission of Vork is to provide an MVC architecture with a full-featured toolkit and universal database support without adding overhead, creating slow & unscalable abstraction layers or re-inventing native PHP functionality.
- PHP – any version between 5.0.2 and 5.3.x
- A database is optional and any database or cloud-DB that is supported by PHP will work with Vork
- Built-in support for multiple master/slave database configurations as well as both NoSQL & RDBMS
- Works on any web server (Apache, Microsoft IIS, etc.)
- Works with any operating system (Linux, Windows, Mac OS X, FreeBSD, etc.)
- Integrated caching through any package with a PHP interface (Memcached, etc.)
Vision Media created the UltraLite framework with a need for a light weight, high performance, ajax ready, feature rich framework. UltraLite was built from the ground up with high performance in mind. Page caching, conditional loading, core Content Delivery Network support and much more. You can score a 98% YSlow grade with only core features. The UltraLite features are the following:
- High Performance
- Core Cache Drivers
- Database Astraction
- Cleal URLs
- Code Hinting
- Page Cache
- Slim Source
- Conditional Loading
- Simplified Learning Curve
- Ajax Ready
- Ajax Plugins
- Rapid Theme Development
- Form Builder
- Form Validation
- Form Validators
- PHP 5.x
- MySQL db
12. Simple PHP Framework
The Simple PHP Framework is a pragmatic approach to building websites with PHP 5. It’s geared towards web design shops and freelance programmers looking for a common foundation to quickly bring web projects to life.
- PHP 5.x
13. BaseApp Framework
BaseApp Framework is aimed at individual commercial developers or small web application builders who need a starting point.Also if you are a CakePHP User you will find yourself at home with the API. It has support for most common features available in frameworks these days but achieves all this in under 50 Kb of compressed Code. The technical feature of this framework are:
- PHP 5 with support for new features like autoloading etc
- Fully MVC ( But can be used as a library also )
- CakePHP API ( 80 % ) and Layout
- Active Records and Object Relation Ship Mapping (ORM)
- Model Validation with complementing form helpers
- Data Abstraction Layer with Adodb Support ( Almost all databases supported )
- Extensive Debugging and Exception Handling facilities ( FireBug Support Built in )
- Extendable Cookie and Session Handling
- PHP 5.x
14. Caffeine Web Framework
The latest incarnation of Caffeine Web Framework was written to target PHP 5.1, and is distributed under BSD license. Instead of vague phrases about performance and simplicity here are some architectural highlights:
- The system uses pure-PHP templates and config files.
- The directory layout is strictly hierarchical, so if you see something referenced in the code, you will immediately know where to find it.
- CWF does not use variables in the global namespace.
- The system uses a single point of access for all HTTP calls. Short URLs are handled in PHP itself, without the need for .htaccess files.
- Any method of any class that extends Module is automatically callable from the web. Output of echo statements is streamed to the user.
- There is a subsystem for automatic permission handling.
- There is an ORM layer, which uses PDO and consists of only two classes. Record handles most of the ORM work, while Link allows for object-oriented management of many-to-many relationships.
- PHP 5.1+
15. PHP Peanuts
PhpPeanuts is an open source MVC framework for developing database-backed applications in PHP. It supports high and sustainable developer productivity by default reasoning and the ‘once and only once’ principle. With phpPeanuts you do not build an application from the bottom up. Instead you get one scaffolded from meta data, then extend and refine it step by step to make it more and more like you want it to be. PhpPeanuts does in general not generate code. Instead it generates the application behavior dynamically on each request. It doesn’t do just CRUD, relations and searching are also scaffolded. When you adapt your design the scaffolded parts of your application will adapt dynamically with each request. So you can start with the simpelest thing that could possibly work for your application, and refactor later if the need arises, without losing much productivity. The eXtreme Programming way. PhpPeanuts is not a Ruby on Rails clone, it was released earlier and has together with its predecessors a history of over 16 years. Yet it is only 731 Kb of code. It that can be browsed an seached on line to understand, override and extend it to serve your requirements.
- webserver with PHP version 4.3 or higher;
- Database that supports full SQL JOIN and LIMIT syntax (with php4 only MySQL and SqlLite are supported, but you can write a Dao class for the database of your choice);
- modern web browser (IE 6 or up, Mozilla 1.5 or up, try out the examples to see if your browser is OK for phpPeanuts).
Zephyr is an ajax based framework for php5 developers. You can easily develop business applications using this robust framework. this is extremely easy to learn and very simple to implement. You can deliver a full fledged ajax application with strong business layer in backend within some minutes. Installation and deployment of packages that you develop for zephyr is hassle free. Moreover you will get all the features of most popular templating engine “smarty” and powerfull data access layer “adoDB”.
- PHP 5
17. Samstyle PHP Framework
Samstyle PHP Framework is a faster, lighter, and ever greater PHP framework that is prepared for development in modern web environment. It has the set of tools, functions and methods ready for web development. Be it email validation, template handling, error management, flexibility, content management, or speed, it is far superior. The project aims to develop a fast, greatly optimized, scalable and easy-to-understand framework for PHP. Samstyle PHP Framework has the following features:
- Library of functions and support for various PHP versions from 4.4.2 onwards.
- Model-View-Control-Database-Engine-Core (MVC with DEC) Framework model.
- Quickly config, deploy and use – no installation required, on any server
- Easy integration with other APIs, libraries, and applications.
- Is Open Source, and uses Open Source technologies
- Framework heavily tested using Simple Test Unit
- Table Data Gateway and DRY policy
- Support for AJAX (jQuery), Server-side Cache, Session Security, Input validation, Paging
- Database Access Layer (DBA) that assists persistence to MySQL, SQLite or SQLite3 databases.
- JS and CSS Pre-processor that helps to reduce DNS calls and optimize loading
- Lightweight: the framework (no add-ons and content) is less than 50 KB.
- Firebug debugging for server side (after v1.2.10 Stable)
- Managed & Easy URL routing without the need to understand how to configure HTACCESS file (after v1.2.12 Alpha).
- PHP 4.4.2+
Obullo is a Lightweight MVC based Php5 Framework for the PHP Coders who need a simple web toolkit to create full-featured fast web applications. It focuses on being simplicity , readability , performance and writing speed , well documented and easy to use, while solving problems intrinsic to web development. The features are:
- Obullo use PHP5 static methods.
- Obullo use PDO (Php Data Objects) for db operations.
- A new term Global Controllers removes the
long writing and dirty coding.
- It works in directory mode, you don’t need put all codes into one controller. One directory can have more controller.
- Optimized for the minumum code and maximum performance.
- Obullo currently supports PHP 5.1.2 or later versions and recommends the most current release of PHP for critical security and performance enhancements.
- Obullo use PDO (Php Data Objects) for database operations. Mysql and SQLite drivers is enabled by default as of PHP 5.1.0 and newer versions.
In the following comparison table I put the most important features that a framework should contain within itself. There was analyzed the final weight, the easy installation of framework, the validity of documentation and the presence or absence of a forum or a generally support on website.
(Click on the table to enlarge the image)