13 ms·
Why I love Laravel (2022)
- LVB 2y agoWas there some particular event (new release, announcement, etc.) that has prompted the ton of Laravel references I'm seeing on X and elsewhere very recently?
- spiderfarmer 2y agoPeople started using and enjoying it.
- yurishimo 2y agoNope. It’s all Twitter beef that spiraled into drama over the weekend. Prepare for the discourse to continue this week as there will be a few crossover podcasts from JS and PHP land with various talking heads.
- acomjean 2y agoI used to use silex a microframework from symfony. I really liked the limited scope. It’s gone, and they said just use symfony. It’s a jump there are too many knobs, and even though I kinda know what’s going on it can be overwhelming. My summer project is to try larael. I’ve dealt with python,perl and java sites but always come back to php… I know it gets a lot of flack but I kinda like it.
- wesammikhail 2y agoModern PHP is very underrated imo. Just do what I do, use something like Phroute or any other routing library. Add a couple of supporting classes (Request, Response, DB connection, etc.) and you're good to go. If you don't need all the stuff that comes with a large scale framework, there is no point using one. It all depends on your requirements though.
- bravura 2y agoDo you mind doing a quick teardown of modern PHP? The good the bad and the ugly?
- wesammikhail 2y agoHonestly most of what you consider to be good or bad is a personal preference. But what I can say for certain is that framework-less modern PHP is 10x less ugly/complex and an order of magnitude more performant. There are a ton of new language constructs and features which puts it on par with, if not ahead of, most other languages. Here are some of the most recent feature additions: https://stitcher.io/blog/new-in-php-8 https://stitcher.io/blog/new-in-php-8 https://stitcher.io/blog/new-in-php-81 https://stitcher.io/blog/new-in-php-81 https://stitcher.io/blog/new-in-php-82 https://stitcher.io/blog/new-in-php-82 https://stitcher.io/blog/new-in-php-83 https://stitcher.io/blog/new-in-php-83 If you're looking for some fun content to watch about PHP while eating dinner: https://www.youtube.com/watch?v=WsnHWxO7Krw https://www.youtube.com/watch?v=WsnHWxO7Krw
- repox 2y agoIt's a complex task, to be honest. PHP kind of stagnated in terms of development with PHP 5.5 in 2013. It kind of went quiet. Along with an overshared article[0] on how bad and why PHP 5.4 was bad (which the community in all fairness overall agreed with, with some exceptions) PHP got a real bad reputation. PHP 7.0 landed after key persons picked up the development of PHP again, and while progress was slow it really took off from here. It seems like the biggest pain for the entire community is the lack of generics. There's a lengthy explanation as to why it's so difficult to achieve in PHP, but overall the features since 7.0 added has really added some modern value compared to peer languages. A lengthy list of additions is easiest generated by some GPT provider. But the community painpoint is generics. [0] https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
- Raed667 2y agoI had the same issue with Lumen[0] [0] https://github.com/laravel/lumen https://github.com/laravel/lumen
- mavili 2y ago> I wonder sometimes why more people don’t use Laravel (or similar frameworks in other languages) They do. Most people do. If anyone is serious about putting a project up they use frameworks.
- EarthLaunch 2y agoLaravel has been amazing for a long time. I heard its 'convention over configuration' approach was inspired by Rails, and the ecosystem is competitive with anything. For small to medium web projects, the benefits of having JS across the stack has kept me from using Laravel again. That doesn't apply to all projects, though, and I still love it. Waiting for the next thing. Toying with Deno Deploy (no association).
- spiderfarmer 2y agoI'm really wondering: how can people switch frameworks / languages for each project so easily? Isn't there a lot of benefit to not having to learn everything new and doesn't that outweigh any technical advantages of the "next thing". And Laravel for example has such a broad, high quality ecosystem, that is mostly lacking in new projects..
- dotancohen 2y ago> I'm really wondering: how can people switch frameworks / languages for each project so easily? My trick is to use Anki to remember the important details occasionally, and before starting a project in any particular language or framework to heavily review that language or framework in Anki beforehand. After doing it a dozen times in each direction it gets easier - the advantage of being old is that one has much experience.
- EarthLaunch 2y agoI agree that there's a lot of benefit to sticking with a thing. I've only seriously used Perl, PHP, Erlang, and Node, over 20+ years, deliberately. For productivity. One reason for switching and trying is a fascination with finding the next amazing thing, always hunting for something new and better. Usually it's only slightly better, or not better. But sometimes you find Elixir, Laravel, or Deno. And it's more fun and productive, plus you're ahead on the resume.
- spiderfarmer 2y agoThat seems to explain it quite well, thanks. I only care about being productive and really do not about my resume as I only work on my own projects.
- repox 2y agoI've been working with Laravel since '13 and PHP since '99. Both just keeps becoming better and better to me. Recent years of needed improvement and feature development of PHP, keeps me happily invested in continuing with PHP as well. I tried NodeJS/Typescript for a couple of years, between '21 and '23 - I never learned to like it and leaving the community was the best decision for my mental health in a software development context.
- anonzzzies 2y ago> and leaving the community was the best decision for my mental health in a software development context. Undervalued sentiment.
- jmnicolas 2y ago> and leaving the community was the best decision for my mental health in a software development context. May I ask if it was for technical reason (JS ecosystem breaking constantly) or for people reason?
- repox 2y ago> May I ask if it was for technical reason (JS ecosystem breaking constantly) or for people reason? The "people" is the reason why the ecosystem keeps breaking and there's no consensus on how to do what; so the answer is both in a combination.
- chipdart 2y ago> I tried NodeJS/Typescript for a couple of years, between '21 and '23 - I never learned to like it and leaving the community was the best decision for my mental health in a software development context. That's an interesting statement, as it heavily contrasts with my personal experience. From the start, TypeScript felt as a breath of fresh air and the whole experience was very enjoyable. The only (and major) drawback was having to deal with JavaScript frameworks which required tsconfig.json/webpack voodoo to work at all, let alone with TypeScript, but once the project was sorted out everything was a pleasure. Can you point out the single most egregious thing you experienced with TypeScript?
- btreecat 2y agoI think loving your tools is good. While there's no framework that's _better_ than the language, there are ones that are worse than the language they are written in (Grails comes to mind). I just don't _want_ to work with PHP, at all. But it I had to I would prefer to enjoy the tooling.
- pouzy 2y agoAre you French? Seems like the only place where PHP is still popular is France because of Symfony. But for the rest I agree, coming from Rails and now working in Typescript: Rails is way faster for building stuff, but building scalable apps in a team that scale without a typed language is way more complicated
- 5e92cb50239222b 2y agoIn some ways current PHP has much stricter typing than TS as it's actually checked at runtime.
- asyx 2y agoGermany as well
- ilrwbwrkhv 2y agoLaravel with Livewire Volt is fire. This is like how Python used to be during Java days and when pg wrote the famous essay.
- mastazi 2y agoThe author asks > I wonder sometimes why more people don’t use Laravel (or similar frameworks in other languages: Rails or Adonis) these frameworks, and other similar ones, often assume that 1. there is some sort of UI or frontend 2. there is a relational database that the app is connecting to 3. there is some sort of auth, based on usernames and passwords with the stuff I do at work, these assumptions are almost always incorrect. (edited grammar)
- theonething 2y agowhat kind of stuff do you do at work?
- sshine 2y agoI write firmware for high-power EV chargers. Before that I took part in working a zkVM (cryptography) and before that I ported a PHP web app to Kubernetes; it was written in Laravel. Web frameworks are excellent for CRUD. Not everything is CRUD.
- mastazi 2y agoParent here, I mostly work on backend web services that connect to other microservices in various ways.
- theonething 2y ago> Being able to scaffold out user logins immediately I still don't get why Rails doesn't have this out of the box.
- deleted 2y ago[deleted]
- creamyhorror 2y agoSeems like almost no Node framework has this out of the box. Maybe AdonisJs, but I think you still have to create login and signup page templates yourself (and password reset forms, etc.). It's probably because Node is used to back self-designed SPAs, but it's still a bit of a bummer for getting a new idea off the ground quickly.
- KronisLV 2y agoIn my eyes, that felt like something that should be separate from any given app or back end API, so in my case I use mod_auth_openidc: https://github.com/OpenIDC/mod_auth_openidc https://github.com/OpenIDC/mod_auth_openidc with Keycloak: https://www.keycloak.org/ https://www.keycloak.org/ My back end/app just gets a few headers that say who an authenticated user is, if they are logged in. When I need to log in or create a user, I can just direct them to the Keycloak SSO portal, where they can also use social login. It's using OpenID Connect without the insanity of dealing with the low level logic. And the Relying Party implementations work across any technology, be it PHP or Ruby, Node, Python or anything else (a simple auth filter that checks the headers is trivial across all of them).
- elchief 2y agoStuck on a php 7.2 app at work, but we do use Laravel Valet (easy php, nginx, dns, and ssl on mac), and Eloquent, and they're great Watched a course on Livewire, and really looking forward to using it in the future
- novalis78 2y agoLivewire is fantastic!
- theanonymousone 2y agoMany people praise the PHP-native model of mixing HTML with server-side code (Dynamic HTML if I remember correctly), and rightfully so for many use cases. But I wonder why no other languages has implemented this model, not even Python which is used for almost everything. Templating is not the same thing as the language in the template is normally not the complete host language, and JSP is quite old and did not even support Java 8 the last time I tried :/
- resonious 2y agoThe React server side components crowd seem to have figured it out!
- steve1977 2y agoIs .NET Razor Pages not also using this model?
- darylteo 2y agoNah, Razor is a template engine. Laravel's equivalent is Blade. They're templates in the same that the templates is compiled into a string with parameters then the string is output to the response. What top post is referring to is the ability to control what is output to the buffer (raw characters) and what is scripted (<?php ... ?>). The closest equivalent would be classic ASP (not asp.net)
- theanonymousone 2y agoAs a side note, I once tried to do a hello world in Razor because of its Wasm capability and found the documentations unbelievably horrible. Admittedly I am not a .Net developer.
- mike503 2y agoDHTML was HTML mixed with JS/VB type scripting[1] not server side stuff like PHP :) 1. https://en.wikipedia.org/wiki/Dynamic_HTML https://en.wikipedia.org/wiki/Dynamic_HTML
- sebstefan 2y agoI had a good experience making things with Laravel but the downsides of php are still there for you to feel when you're coding with it I'd rather use something else in 2024
- afraca 2y agoI have about 7 years of professional Laravel experience. I think it's quite slick! There is one aspect I haven't seen mentioned here that frustrates me: the community is quite eager to make new shiny things and forget about existing things. I feel the core framework doesn't get a lot of love anymore, and the same for some other packages. Something like Homestead got introduced as a huge thing, but got relatively quickly replaced with Sail and Valet it kind of seems. (Yes, they have a bit different corners, but I would say it doesn't justify a complete package) For authentication you have multiple packages that were introduced as the holy grail but now sit in an awkward spot with each other, and similar for frontend things packages. Another small frustration for me is all the huge adjectives being used: - "Laravel Horizon provides a beautiful dashboard ... " - "Laravel Jetstream is a beautifully designed application... " - "Laravel Octane supercharges your application's performance..." - "Laravel Prompts is a PHP package for adding beautiful and user-friendly forms ... " - "Laravel Reverb brings blazing-fast and scalable real-time WebSocket ..." - "Laravel Sanctum provides a featherweight authentication system ... " - "Laravel Telescope makes a wonderful companion ..." - "In other words, Valet is a blazing fast Laravel development environment ..." I think it would we wise to do a bit of a cleanup and merging of official packages, and to not forget about the core framework. I think Symfony shows you can still do great additions even after many years like Targeted Value Resolvers [0] You can see all the official packages clicking the "Ecosystem" button in the header of laravel.com [0] https://symfony.com/blog/new-in-symfony-6-3-targeted-value-resolvers https://symfony.com/blog/new-in-symfony-6-3-targeted-value-r...
- begueradj 2y agoI agree with what you mentioned. But don't you think the same holds true for every other web framework and related packages?
- blerb795 2y ago> Another small frustration for me is all the huge adjectives being used wow you weren't kidding -- the docs [0] for each of the "packages" could easily be confused with AI-generated text written as a joke [0] https://laravel.com/docs/11.x/octane https://laravel.com/docs/11.x/octane
- darylteo 2y agoPHP tends to be a red flag for security specialists. When talking to other technologists I tend to get eyebrows if I mention building a product in PHP. Most of the damage is done by Wordpress, unfortunately. I think Laravel is a boon for no-nonsense rapid application development.
- mike503 2y agoYep. It's scary to enterprises, because of lazy (or incompetent) security folks. It's just like any other language. They just look at crap like WP and the amount and ease of code dumped out to the net. Disregarding the actual stuff that would actually be used. It's actually PHP's success and simplicity that creates the volume of code (and thus volume of bad code) that gives them that impression. I wind up using PHP for tons of scripting or internal tools still. :)
- LauraMedia 2y agoI've been working with React, Vue, Nuxt/Next, even some ASP.net... Somehow, I keep coming back to Laravel when creating a new dynamic project. Whenever I setup a new project in other frameworks, I get exhausted afterwards, I had this great idea I wanted to try out, but after the setup, I lost all motivation. It's different with Laravel, because the setup is so much quicker and it has everything I need preconfigured out of the box. I don't mind writing PHP, my heart loves C# but I've worked with PHP for almost a decade now. The best thing is, that I can STILL use Vue if I want (and I very often do) through Laravel Breeze.