Have you ever heard this question? If yes, so there is a misunderstanding. Simply, PHP is a language and Laravel is a PHP web framework you use for simplifying the hardwork.
If you’ve heard about php frameworks like Laravel, Symfony, CodeIgniter etc, you may ask yourself why should I use these frameworks? When I can get request parameters, store data and handle my logic, why should I use frameworks?
Let me demonstrate the future problem with a story. Think of when you get your programming project, and you start to plan for this project. For example a simple accounting project. First you design a simple UI with HTML and CSS, and you continue with defining user flows and use cases for this application (naturally our solution for this accounting application is web application). At this step you know about application processes, for example you know you have a login page, you have a page to define employees and something like that. So, now you have everything to start coding with pure php. You know php syntax and you do coding very well, and all is done. You make it very well.
The problem arises
By now everything is fine! And application is ready to use. After 6 months you decide to add new feature, or your employer tells you new business needs (we know that every feature comes from a business need, and the most important thing is that the business needs are endless. Agile).
So, now you should come back and do some refactoring (changing existing code to meet current needs) or in best situation you must add some code. But you find out that you do not remember why you created some classes, their role and how they really work! (think about this situation for more complex applications and software). So you are in trouble..! What is the solution for this situation? You start to define some structure for your coding, may be even more commenting, and defining some conventions (for example you group classes with directories). And if you do it very well that means you are creating your own framework 🙂
The main reason to use a framework is to escape from an unstructured code (known as spaghetti code which you cant find any rule within it). Also it has many other benefits, for example when people follow a common standard, they can help each other, and code for other systems and applications (mostly developers have indirect cooperation through packages). It worth to mention that this is not only for pure php, the scenario is the same for other languages.
In this article, first I’ll tell you what problems I encountered and then I assess some existing Laravel platforms for laravel blogs.
First let me explain the scenario that I dealt with it. Consider when you have a Laravel project and you want a blog functionality for it.
My scenario has some requirements for blog system, for example the blog functionality must support commenting, defining categories for posts, light-weight, giving front-end, and flexible for further customization. Also preferably it’s better using a free solution.
Based on the mentioned requirements (even without the requirements), we have some solutions:
- The easiest way is to use a package which provides blog functionality
- Using some platforms which act as a basis for our website, really they are a complete Laravel setup
- Integration with other blog platforms like the most popular WordPress
- Using a separate blogging system
Let’s look at each of these ways. But I begin from the last solution. Also obviously there is a solution that you can build a blog system from scratch which fits your needs exactly, but you should consider all aspects of a blog.
Integration with other Platforms
I checked integration with WordPress. There are some ways and packages to do it. you can check this article to know more about this.
This approach has some big drawbacks for example it has an overhead over your website and for some scenarios it’s a little complicated. You can also try to share sessions between Wordpres and your Laravel website through JWT or a solution like Auth0 which acts as a intermediate layer between your WordPress and your Laravel website. Also there are some considerations, this approach assumes you use WordPress as your authentication engine which may conflicts with your needs.
If you use this approach and handle these drawbacks this is the best way, because you get benefit from a powerful platform like WordPress which is specifically designed for blogs.
A Complete Laravel Setup
There are powerful platforms which give you a fresh setup to your website and you can build your logic over them. One of the most popular is October cms. When you install this software you have a complete Laravel website. But when you see the underlying code, the structure is a little different from the fresh Laravel setup. It also offers new concepts over the Laravel. Also it does not support commenting out of box. All of these issues show that you need another expertise plus your Laravel knowledge to develop your business logic. And for your existing Laravel project it has nothing to say.
Other platforms like Pyrocms and Lavalite have same issues. In Pyrocms you must pay for commenting functionality.
The main issue with these platforms is that you should adapt yourself and logics to their platform and you must learn to develop them.
Canvas and other publishing platforms have good editors but they have big drawbacks, like lack of front-end, weak customizability, and also lack of commenting..
Twill platform has some drawbacks like October platforms, which you must spend much time to learn about customization. Also Twill has its own models for user authentication!
To solve these problems I started a project (a laravel package) which meets all of these requirements. You can read more about this package at this article.
It’s up to you to choose between these solutions, but I prefer a solution which does not make me dependent to any platform, and ease of customization is one of my considerations.