PHP Development / WordPress for Beginners

WordPress integration with CodeIgniter

No doubt that both WordPress and CodeIgniter are excellent technologies, and this post is not about why one of them or the other is better. There is a good reason why WordPress is so popular, and also CodeIgniter, which is often compared with Laravel and Symphony and labelled like “the worse one”. Reality shows however, that CodeIgniter thanks to its features can decrease cost of development.

Big advantage of CodeIgniter is fact that it has very small footprint, and is a very simple PHP MVC framework, and very flexible on top of that. It is not one framework good for every possible project, but good enough for small up to medium size projects. The only pain is that it comes without templates, so layout is your problem, which can be fixed by using Bootstrap.

WordPress on the other side comes with easily installable themes, and whole bunch of functionality, which not always is needed, yet thanks to that it is also very flexible. You don’t need to use all functionality provided by WordPress. Also, functionality can be easily extended by plugins or WordPress themes. Because of the all unnecessary stuff provided by WordPress out of the box websites can be slow. But, this can be solved by caching plugins and you can easily go down below 1 second page load time (however keep in mind that it depends on network).

I found that there are often projects – online services or applications – where not always WordPress or CodeIgniter alone can do the job properly. Usually it is scenario where it would be good to have WordPress as a kind of out of the box front end interface, but also CodeIgniter, which due to its small footprint would do much job. To get integrated WordPress and CodeIgniter the first thought is to to look for some integration plugin, or ready solutions where you can just install something and get full integration for scenarios like user logged in WordPress is also logged in CodeIgniter.

I spend much time to find eventually, that there are no good download-and-install solutions for WordPress and CodeIgniter integrations. The best what can be done is to have communication bridge between WordPress and CodeIgniter via API. One PHP script on WordPress side and REST API on CodeIgniter side to exchange data. Full integration on user logged-in level cannot be done due to security reasons. So, at least in my opinion, the best option is to set API ports on WordPress and CodeIgniter sides for exchange of information via CURL. This solution is very flexible – you can exchange only needed information (for instance about users who paid or not paid subscriptions etc.), and out of the box you can use advantages provided by WordPress and CodeIgniter.

In general all PHP MVC frameworks are faster than WordPress, but WordPress has some serious commercial advantages, which can speed up development and save much time.

In general, you can “integrate” CodeIgniter with WordPress, messing with some code pieces on both sides, but it will not be smooth integration. I found that such deeper integration, which would be very beneficial, can be affected by themes and plugin used by WordPress. So, in the long run, this can be very costly option. We like it or not, but WordPress is not developed with CodeIgniter in mind, and vice versa.