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 -
- 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
- 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.
- 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.
- 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.Posted in: #SEO
One more important thing that I forgot to add - 'Cache'!
Cache can add lightening speed boost to any of your application; provide you use it judiciously. There are plugins available for WordPress that help you make use of object caching and speed up stuff. Redis, has become my favorite in the recent times.
Laravel too has an in-built Cache support which you can use to store your key-value pairs. For several memory intensive tasks I prefer using Redis Cache and we do have a separate Redis server here to serve CrazyEngineers.
We still don't use it to its full potential; but plan to do so in near future. If you are planning to develop any web application; pay extra attention to various ways you can make use of Cache services. You'll be happier.
Someone wrote to me asking if it's easier to code apps on WordPress Vs. Laravel
I thought of answering the question in this discussion, because it's relevant. TL;DR - It depends upon the type of project you are working on and the complexity involved.
The biggest advantage with WordPress is that you can get a lot of functionality through Plugins - but that's when the functionality is very straightforward.
In general, it's actually faster to code web applications using WordPress. Why? Because everything works on the top of Custom Post Types. If you want to make a Job Board - you will simply have to create a CPT by the name of 'Jobs' and then make use of the post_fields to define various aspects of a job post - like title, body, number of applicants etc.
If you want to create an events application with WordPress, you could simply create a new CPT for 'Event' and then use custom fields to add desired data.
As discussed earlier, you will have to get almost everything accomplished using WP Query.
Coding Apps with Laravel
Laravel more or less mandates the use of Object Oriented Programming. Which means, you will have to distribute your code in terms of objects and classes. There are large number of high quality packages available which will definitely speed up your overall development.
The key to note here is your overall familiarity with OOP. If you are well versed, your should opt for Laravel to code your apps. Else, you will end up spending much of your time figuring out the basics.
I've found Eloquent to be super useful and intuitive to use to perform complex database queries. Eloquent makes writing complex model relations easy.
The bottom line is that it depends upon the kind of application you are building and how complex it is. In general, you can get almost everything coded on the top of WordPress. But if time isn't a constraint, you could definitely code it better with Laravel.
I hope this helps.
Hey Kaustubh, Actually I am currently working on Wordpress and I loved it. It is really easy, convenient and smooth to work on it. Especially for beginners of creating websites, it is one of the best platforms. Actually, this is my personal experience with WordPress and I am not denying your arguments.
Good to know, Addy. Could you share what exactly are you building with WordPress? Is it an app or a content blog?
Laravel Vs. WordPress - SEO Perspective
Couldn't help cover this! This is an important factor that I think should be discussed a bit in more detail.
As I mentioned earlier, the big advantage with WordPress is that content based websites can make use of the established SEO plugins. WordPress, for example, can make use of the Yoast SEO plugin and have most of their SEO take care of by default.
Plus, the maintainers of the plugin keep the plugin updated with latest advancements and developments on SEO front.
For Laravel, We're on our own!
Because Laravel is meant to develop web apps, SEO wasn't the focus. It's the job of the content management system, that can be written with Laravel. I don't have any experience with a full fledged CMS built using Laravel; but I think October and PyroCMS do a good job of SEO.
However, WordPress with its plenty of SEO plugins is something to be envied by Laravel users.
When you are building an app that is meant to handle lot of content, you've to be aware of most of the SEO aspects - like breadcrumbs, meta tags, semantic html, page structures, image compressions et al.
It actually becomes a 'burden' when you are developing apps with Laravel. At times, you feel like you are reinventing the wheel. If someone knows if there's a package for Laravel that helps with SEO, I'd definitely be interested.
Laravel Vs WordPress : Security
Continuing the topic - let's talk about security aspect when deciding to choose Laravel or WordPress.
Security is a very important factor for any web venture. WordPress has been around for a long time and it's generally a safe software to run, provided you run it on a good, hardened server.
The biggest issue with WordPress is that a bad plugin can ruin all your security - and even WordPress can't control that! The WP support for plugins is both a boon and a bane. It's a boon because it can get you a lot of new functionality right out of the box.
But when you install a plugin developed by a developer who either doesn't know how to code well; or has intentionally created bugs to ruin WordPress security measures; you're helpless. I've faced this issue.
I installed a 'user login' plugin for WordPress and that had an issue. It allowed anyone to login with a typical password. It didn't damage anything on the site because I discovered the bug before anyone else.
With Laravel, it's a different story. A poorly coded package can create issues; but because these packages are mostly used by the developers; bad ones are quickly filtered.
Of course, you can write your own bad code to ruin everything; Laravel itself is a very secure framework.
Is there any specific question you'd like me to answer about WordPress Vs. Laravel faceoff? Let me know.
Update: Someone sent me a question how do WordPress and Laravel compare when you're interacting with them through the API.
Frankly speaking, I don't have much experience working on WP API so I can't comment on the speed and performance. In general, if you've enabled caching - both platforms should work fast. In general, you might see a few milliseconds of difference based upon the amount of content being transferred with each request.
I will stick to my earlier comment - don't fret over milliseconds of performance difference. Just focus on rapid product building and you'll be all good.
Wow. This is such a wonderful resource. Thanks for writing about it @Kaustubh Katdare
If I want to make a website like Swiggy or Zomato, than which framework will be the best and is it possible to develop an admin panel like Wordpress on that website? I also feel that with plugins like JetPack/Yoast Seo/ W3 Super cache, Wordpress becomes the obvious choice for beginners like me to start their own startup website. What do you say?
The choice of framework will most likely be determined by your comfort level with the language used by the framework. Talking about Laravel or WordPress - you can build Zomato or Swiggy with them; but my advise would be to go with Laravel.
Zomato hosts reviews of restaurants; and I believe WordPress would be a better choice. You can build a Zomato clone with a few free plugins on WordPress.
Swiggy, on the other hand focuses on food delivery. I'll recommend using Laravel to build the backend.
Of course, there are several other considerations involved.