I usually use Nginx instead of Apache. Also I would advise to use Laravel Forge and maybe even Laravel Octane for insane performance.
Yes, Laravel is great for eComm.
I'm learning Laravel now because I thought it would be better to build an e-commerce site with it rather than PHP alone.
But is the Laravel stack in general (Laravel(PHP), MySQL, Apache) good choice for e-commerce? Or I should go with another option?
Any cons and pros? and tips from you guys about the site itself? Important tip for production, things I should note for the future etc..
@stacker The benefits of using Eloquent models (relations, scopes, etc) far outweigh building queries by hand using the DB facade. Using models is also more expressive, and you can add business logic methods to model classes. You can’t do that if you‘re just doing DB::table calls all over your app.
The misnomer of Eloquent being “less performant” than using the raw query builders only becomes apparent if you’re dealing with thousands of rows in one operation. Of course hydrating row data into classes will be slower than just returning the raw row objects themselves, but you should be limiting your queries to only fetch the rows you need at that time (i.e. via pagination), so at that scale (fetching dozens of rows rather than thousands), the difference in performance is not noticeable and will be microseconds in difference.
That being said, Laravel is not a snowflake. All good practices still apply when using Laravel. If there’s data you’re fetching often but changes infrequently, then you can cache it so you’re not constantly querying your database for the same data over and over.
Please or to participate in this conversation.