I’m quite familiar with WordPress, but have just minimal experience with PHP frameworks such as Codeigniter. When building a custom application, say for example an invoicing system or time management app for my company, does it make sense to use WordPress as a framework, or would it be more advisable to use something like Codeigniter? What are the main differences in these two approaches?
Leave a Reply
You must be logged in to post a comment.
Most frameworks are specifically designed to easily handle a large range of applications, while WordPress is quite limited when it comes to using its API to create applications like the one you mentioned. If you want to compare WordPress as a PHP framework with existing popular frameworks, think of it as one of the worst options.
It’s not that you can’t implement certain functionality in WordPress, it’s just that you will do it by writing more and less maintanable code than in Yii, Cakephp, codeigniter etc.
My suggestion is to use whatever you feel more comfortable with. If you’re willing to spend time learning to work with Codeigniter, go with Codeigniter, but if don’t have that time you should probably stick to WordPress.
One area where a framework (CakePHP, CodeIgniter etc.) may be more beneficial than WordPress is in the way they represent the relationships between data. Most frameworks will give you the ability to easily define lots of independent “data types”, and – importantly – define how these data types are connected to each other. This is something that you’d have to spend a lot more time trying to get working in WordPress.
For example, if building an invoicing system, you might have the thought process:
Here, User, Project, Invoice, Client are all data types (in frameworks, you’d call them Models), and you can see the connections that may be formed between them in this simple example.
WordPress might struggle to represent more complex connections, wheras a framework would give you the flexibility to implement this from the start.
Perhaps you could think of a framework as a “blank canvas”, wheras WordPress is more like “paint by numbers” (meant in no way as a dismissal of its abilities, just more that you can see from that analogy how it would guide you, as a developer)
You can think of WordPress as a feature-rich platform onto which you can layer simpler functionality. You’ll be able to make use of custom post types which can then make use of installed plugins – For example, you could create an “Invoice” post type, and then install a user permissions plugin to restrict access to Invoices based on specific rules.
In the same way, you could think of a framework as a less feature-rich platform, but with much more potential for expansion and customisation. So you could create data types “Invoice” and “User” within your framework, define “User” hasMany “Invoice” and build your own rules into the system. This way, you wouldn’t run into problems trying to implement required functionality using existing plugins, or spending a lot of time trying to implement them yourself.
WordPress will most likely give you the results you need, but will keep you within a more restrictive (yet very feature-rich) environment and you could find yourself running into walls with development occasionally. A framework will let you implement much more powerful features, but will require more effort and knowledge to get it off the ground.
(A comment in that video you linked to in a reply outlines it quite nicely – WordPress will provide that “base functionality” but at a higher level. E.g. Caching can be implemented with a plugin, but this can also be implemented in a framework if you have more indepth knowledge of the code and how the framework is constructed)
I tend to use WordPress for smaller client projects where there isn’t so much requirement for interconnections between data. (e.g. for a portfolio website, where you might have “Portfolio Items” and “Clients” and nothing terribly complex going on between them) On the other hand, if a project would call for more than about 3 or 4 distinct types of data, I’d choose a framework.