Using WordPress as a PHP Framework
There are loads of frameworks in the world, even more if you look at non-PHP frameworks, and they all try to address the funademental requirements for application development. For serious development work these frameworks can do a lot of the heavy lifting for you, but if you just want life a little easier why not try WordPress?
What are they key things that you want a framework to accomplish for you? Off the top of my head:
- User registration and login
- Database abstraction
- Application structure e.g. Model-View-Controller
- URL structuring
- Image manipulation
With a little thought, and by thinking in a different way, WordPress can accomplish these things for you, and more.
The combination of plugins, themes, and core files can be used to create a really nice separation of data and presentation. It requires a little thought beforehand as to where you draw the line between the two, but it is up to you how much separation you want.
User management is already included and a simple plugin to redirect users once they have logged on can prevent access to the admin interface so that users get a seamless experience.
URLs can be dealt with ina number of ways. You can use WordPress pages and shortcodes to add the apps functionality. This allows backend control over the page content and lets you set and change the URL for any pages you want. Alternatively you can write another plugin to create new URL structures that direct to custom theme pages.
If you use posts to hold each entry then you can use the optional permalink structures and single post pages to display the information with very little coding at all. The ability to add custom fields means you need never even touch the database directly, relying instead on built in post functions, you can use the existing template tags, search and archives, and you can allow comments on items without any coding.
Finally, WordPress posts have support for both categories and tags, and contains some of the major user interface frameworks that can be used to interact with these. These can be searched, sorted or Add a simple plugin, such as my Fun with Categories plugin that allows posts to be filtered by two categories and it is easy to see how an application can be develop pretty quickly.
There are, of course, things that WordPress is missing. It doesn’t make use of PHP 5 features such as the improved OOP features, but there is no reason why you cannot use these yourself if you don’t intend to release your code to the wider public.
There are lots of posts showing sites that you wouldn’t clock as WordPress based, but are there any applications? The next time I want a quick and easy application, I will certainly be looking at WordPress first.
Add New Comment
Viewing 2 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment