Laravel Vs. WordPress - Speed, Performance, Security and SEO - Which is better?
How do Laravel and WordPress compete with each other on the basis of Speed, Performance, Security and SEO? I was faced with this question about 1.5 years ago; and having developed apps on both WordPress (WP) and Laravel, I think I've something to add to the discussion.
Comparing Laravel and WordPress is like comparing apples and oranges. Of course, both are written in PHP and both are immensely popular; but the key thing to note is that both these software are meant for different purposes.
WordPress is a popular Content Management System (CMS) and Laravel itself is a 'framework'. Of course you can use WordPress to develop web applications; and you can build a CMS using Laravel. So how was my experience with both in terms of performance and speed?
Developing Web Apps with WordPress
The reason I chose WordPress initially to develop applications was simple - I was new to programming and wanted something really simple. There's a very large ecosystem behind WordPress that keeps it alive and kicking - and it's really easy to find solutions to the coding problems you'll face.
The community helped me a lot initially. There are following pros and cons -
Pros:
- Excellent Community Support
- Really easy to start building apps
- Easy to do stunning landing pages for your app
- Authentication is taken care of using well established plugins
- Basic SEO is done
Cons:
- Everything revolves around 'Custom Post Types' (CPT)
- WP Query is the king, everything must pass through WP Query. Now, that's when you take the normal approach to using inbuilt functions.
WordPress Speed and Performance: I think a lot of people would object when I say, WordPress performs quite fast; provided you are not slowing it down with poorly coded plugins.
We've had about ~500 simultaneous users, each making a POST request to WordPress and we ran it without any issues on a virtual server with just 2GB of memory. We did have caching in place; but it wasn't optimised at all. I was impressed.
Most web app developers love to think that WordPress is slow. Yes, it might be slow when it comes to responding to requests by few milliseconds. But you aren't building Facebook on the top of WordPress, right?
And frankly speaking, more challenge is to get a large number of users to slow down WordPress than worrying over a few milliseconds of delay. It's just stupid, IMHO.
Developing Web Apps with Laravel:
With my background in WordPress, it took me about 2 months to make any progress with Laravel initially. Now, when I look back, I wish someone told me the basic things right and I'd have saved a lot of precious time. Maybe I'll write a Laravel beginner course in near future to help newbie developers.
The biggest challenge for me was to get used to the Object Oriented way of writing code. It was overwhelming at first; but as things began making sense; I couldn't help but appreciate how easy things are when you go the OO way.
Laravel addresses a large number of problems you'd otherwise face right out of the box - and that could be the reason it's gaining massive popularity in recent years.
Pros:
- Beautifully organized code! You won't appreciate how important and useful this is, unless your overall functionality count goes over 50. That is, as your code grows - you need something that you can reuse and Laravel solves that problem to a great extent.
- Everything can be customised. You control what goes where and how things work.
- Define routes your own way. When we were making a switch from XenForo (our old software) to Laravel, keeping the routes intact was the biggest challenge for SEO reasons. Laravel made it super easy.
- Database - your own way. While normalizing your database is cool; sometimes, you can achieve more simply by putting stuff in a single table. Don't get mad at me. I do make use of Eloquent Relationships like mad and absolutely love it.
Cons:
- You've to code everything! After switching to Laravel, I began appreciating the importance of WP Plugins. Sometimes you think you could simply use a WP plugin to achieve a simple functionality and not reinvent the wheel.
- SEO - you'll have to take care of it on your own; if you are developing a website that relies on content a lot. It's lot of work!
- Design - you'll need to do this on your own. Creating a healthy user experience is quite a challenge!
Laravel Speed and Performance:
Laravel is a framework - and it's super fast. There's often debate on Twitter and other social platforms where it's compared with other established frameworks. It's almost funny to see how developers go mad over a few milliseconds of delay.
Trust me, the performance is problem #2. Problem #1 is to get people. I've found out that throwing a little more money at infrastructure is a better choice over choosing the fastest framework out there and porting your entire code on it.
Amazon Web Services (AWS) is excellent offering and you ought to give it a try if you are running out of hosting resources with your current web host.
One key thing to remember is that Laravel will make use of Eloquent - which will make writing database queries a cakewalk for you. However, if you don't understand how to use Eloquent, it can make Laravel tad slower than any other framework. The problem is with your code, not Laravel, in this case.
I wish I could do a few real-life tests to evaluate the performance of Laravel and WordPress. But I'll save that for a later point.
Until then; do let me know the challenges you are facing in picking WordPress or Laravel (or any other framework/cms) and we'll see what should your choice be.
I welcome your comments and opinions.