For more information about Laravel or PHP you can look at these:
I worked with both plain PHP and Laravel while granted I’m still pretty new to either there are already some noticeable differences. So let’s go over them.
So firstly you can’t use Laravel without knowledge of PHP so to start you should use plain PHP until you’re familiar with the basics and know some more advanced stuff. Since with Laravel a bunch of new functions and methods come and if you’re not familiar with PHP you will be overwhelmed and most likely confused.
But as mentioned Laravel has a bunch of extra functions and features which makes it much easier or more comfortable to do certain things. Now this especially comes to shine when you create a big website / project. Laravel uses something called blade which works with HTML and PHP and therefor makes it easier to include PHP code in HTML code. And another thing that it adds are so called “Slots” with those you can call the code from another file and merge it into wherever you called the slot in your code. This is really handy for navigation or styles or whatever code you have / will have multiple instances of in your project. You can read more about Slots here: Slots
Comparison
I made a project with plain PHP which, after I learned Laravel I copied it with Laravel during that I could notice a few differences that how this whole entry came to be.
A good part of the project was the same since it was still HTML, PHP and Tailwind CSS since I used it with both projects. So the main part so to say is more or loss the exact same with a few differences of course. Those are the styles since Tailwind CSS was integrated in a different way so certain classes worked differently, how I integrated PHP in the code which was clearer and / or less code and also the duplication of code across files. Meaning that the footer or the navigation and header I put in a separate file and pulled in with Slots.
One thing that I noticed that my plain PHP project was simpler in a way and was partially split up since I learned new things and therefor did things differently in the course of the project, which lead to slight differences meaning that in the Laravel project I couldn’t but it in a Blade variable and had to write the code twice (more or less).
What I mean by that is that the buttons or forms looked different for no apparent reason. Now while yes that is something one could easily fix the goal of this task was to copy the project 1:1 or well as closely as possible, so I this lead to some extra work but something to notice or well learn for the future.
The main thing I had a problem with that wasn’t apparent to me was that since Tailwind CSS was integrated in a different way meant that certain classes were written different or needed an extra class to work which before were pulled in automatically. Since these are problems that you can’t see when comparing code or inspecting the website it lead me to be stuck at a few occasions and also lead to some minor difference in visuals. Which then in turn also took some time where I tired to remove those discrepancies which most of the time lead to failure. But this is at times just part of it when you use something different you loose some stuff and gain some stuff and usually you gain more than you loose so in the end its a win and if not, well then you might’ve made the wrong choice in using something but that at times can also very much so depend on personal opinion.
So all in all Laravel is much faster and comfortable to work with especially in bigger projects but also in turn in more complicated since you do need to learn / know more but it just takes a bit of time.
