Once upon a time there was a blogging application called WordPress and after a few versions and a rabidl fanbase, WordPress expanded outwards. As the community improved it via plugins and themes, the direction WordPress started to head in was more of a content management oriented one. Now it’s time to start viewing WordPress for what it actually is: a powerful PHP framework that can be used to build serious web applications.
While the PHP framework race heightens; Codeigniter, Kohana, FuelPHP, Laravel and Yii there has been one silent contender in the background with a larger user-base than all major PHP frameworks combined: WordPress.
Many framework purists will arch their backs and hiss at you for suggestion WordPress is anything but an application, but when you break WordPress down into the key areas it makes a developers life easy you see a lot of similarities between what it provides and what a framework provides.
- A rich and well documented API — Mostly every single aspect of WordPress can be changed via the actions/filters hook based system.
- Authentication — User levels, capabilities and roles, register, login and logout functionality, session management
- Administration panel — WordPress provides a well-styled administration panel which can be completely customised to your hearts content. Limit access to menu items based on user level or capability, custom editing screens, custom option pages, plugin and theme management.
- User management — Add users, edit and delete users, support for custom user meta
- Powerful rewrite system — Most frameworks refer to them as routes, WordPress calls them how they’re known if you’re familiar with mod_rewrite and Apache: rewrite rules. WordPress allows you to create pretty URL’s for anything using the rewrite API.
- Categories & Tags — Support for both categories and tags right out of the box. Easily categorise your content and then easily sort it via WordPress’ easy-to-use taxonomy functionality.
- Decent menu management — The ability to drag and drop order your menus, specify menu locations, unlimited depth of items, ability to easily add in pages, posts, custom post types and links from within the one screen.
- Themes — Complete control over the presentation of your site. No forced conventions or defined ways of styling and presentation of data.
- Plugins — Improve or modify any aspect of the front or back-end of your site. Access to thousands of plugins that vary from adding in support for logging in via Facebook to plugins that completely change the post editing interface.
Although WordPress lacks any kind of structured way to build your applications in a formal sense (MVC for example) there are ways of building a clean application with WordPress. The functions.php file is where you usually would add in all of your logic, but as some of you have probably experienced the bigger and more complicated you get with WordPress the larger this file gets. Don’t be afraid to break up functionality into separate files and include them via your functions.php file.
Think outside the box and consider using WordPress next time you want to build a site in PHP. It might not support cutting-edge PHP functionality or features, but it can get the job done within half the time it would take you to add in any of the above aforementioned functionality.