For plugin developers desiring an easier way to perform common tasks, a little more structure in their code, or perhaps even a dash of MVC goodness, here is a list of WordPress plugin frameworks.
This list is intended to be comprehensive. If you find an actively maintained plugin framework that’s not listed here, let me know and I’ll add it.
scbFramework is more of a toolbox than a full-blown framework. It’s collection of well-designed classes that help with common plugin development tasks. The documentation is a little sparse, but good enough for most purposes.
- Option handling.
- Admin page creation.
- Helpers for creating meta boxes.
- HTML generators for form fields.
- Widget creation.
- Cronjob handling.
- Database table creation and schema updates.
- Automatic filter/action binding.
- Automatically loads latest version of itself if multiple are present in different plugins.
- Miscellaneous utilities.
WP MVC is a full-fledged MVC framework with architecture similar to CakePHP and Ruby on Rails. It seems to focus primarily on WordPress-as-CMS features. The documentation is very good; probably better than any of the other WordPress-specific frameworks listed here.
- Code generator for creating new MVC-based plugins and scaffolding for their models, views and controllers.
- Data validation.
- Model associations (belongs-to, has-many, etc).
- Easier custom post type creation.
- Automatically creates admin menus for each model.
- Pagination helpers.
- HTML generators for form fields and other common elements.
- Custom routing with AJAX support.
- Built-in models for most WordPress items (posts, comments and so on).
- Plugin settings pages.
- Extensive framework documentation.
MTV : Models, templates and views for WordPress
MTV is an MVC-style framework for plugins and themes. Compared to some of the other frameworks you’ll find here, MTV is a little bare-bones in terms of features it offers. It provides structure for your plugins, and little else.
The documentation is decent, but sometimes fails to adequately explain some of the concepts and reasoning behind the framework. Presumably, this will be less of a problem for developers familiar with the frameworks that MTV is inspired by, like Django and Backbone.js.
MTV requires PHP 5.3 due to relying on namespaces and closures.
- Supports both plugins and themes.
- Templates based on the Twig templating engine.
- Basic regex-based routing.
- Built-in models for some WordPress items (posts, pages, users and network sites).
- AJAX helpers.
- Comes with unit tests (based on PHPUnit).
As the name implies, Tina MVC is another MVC-style framework. Aside from a relatively loose MVC architecture implementation, it also provides a couple of HTML generation helpers. Unfortunately, the documentation leaves a lot to be desired. You will most likely need to rely on the source code and the included sample applications instead.
- Helper classes for HTML form generation and processing.
- Input validation.
- HTML table generators with sorting and pagination support.
- Simplified access permission handling.
- You can directly call a controller using a shortcode.
Frameworks that didn’t make the main list for one reason or another, but may be still worth a look.
Supports easy setup of actions and filters, activation/deactivation, form input validation and basic templating/views. Also has a decent directory structure. Very little documentation. In beta.
Supports localization, settings API, shortcodes, caching, WP Cron, style sheet loading, activation notices, plugin action links and more. Also includes includes a template/base class for widgets. Lacks documentation. Appears to have been designed primarily for personal use by the framework author and may be hard to re-use by others (for example, some of the framework methods contain hard-coded URLs pointing to the author’s site).
Provides a template for WordPress plugins. The boilerplate code is reasonably comprehensive, but may not be all that useful for experienced developers. Lacks advanced features.
Another plugin boilerplate, by a different author. Includes boilerplate for DB table creation and upgrades, localization, script loading, style loading, shortcodes, custom post types, custom taxonomies and admin menu pages.
General PHP Frameworks
As an alternative to WordPress-specific frameworks, you can also take a well-known PHP framework and adapt it for use in the WordPress environment. While using a heavy-duty framework like Zend Framework may be overkill for the average plugin, more complex plugins could probably benefit from it. General web frameworks typically have several advantages over WordPress-specific solutions:
- Much better documentation.
- Active user community.
- Extensively tested, stable code base.
- A multitude of third-party components, libraries and tutorials.
With that in mind, here’s a small selection of popular PHP frameworks and links to tools and tutorials explaining how to integrate them with WordPress:
- Simple Zend Framework integration example
- Vulnero - a powerful plugin that integrates Zend Framework into WordPress.
- Integrating Kohana 3 with WordPress
- Kohana for WordPress plugin (outdated, but useful as an example).
- WP CodeIgniter plugin (old-ish)