7 ms·
If you are thinking about building a web application, take a look at Laravel. I not a huge PHP user, but Laravel is always on the top of my list for building we
by impulser_ 4y ago
If you are thinking about building a web application, take a look at Laravel. I not a huge PHP user, but Laravel is always on the top of my list for building web applications. It's the greatest web framework to ever exists, even better than Rails IMHO.
The ecosystem around Laravel is really incredible and unlike any other framework. They have libraries for every stage of a web application from taking payments all the way down to server management and hosting.
They even have awesome libraries like Inertia which are built for Laravel but can be used with other frameworks.
It's the only reason I still stay fresh on my PHP.
- code_runner 4y ago+1 for laravel as well. I joined a php project for a fresh rebuild in laravel and had mostly .net experience. Laravel was great. The documentation is an almost perfect blend of examples and nitty gritty detail. The documentation is almost engaging if you’re coming from other frameworks. I found myself thinking “wow that’s almost no code, what about this feature or that” and the next section would be the exact topic I was wondering about. Had a blast and could learn more php details as I went
- spiderfarmer 4y agoThis is exactly what I told my friends the other day. The writers of the documentation do a terrific job placing themselves in your shoes.
- zeptonix 4y agoJust to offer an alternate opinion for anyone reading -- check out Next.js
- clementai 4y agoNext.js is great but can't compare to Laravel, they are not for the same use case. Laravel comes with an ORM, a job queue, a mail framework... And it can also scaffold a complete auth system for you
- machiaweliczny 4y agoYou can just add Bull/Temporal, Prisma/Knex and Braze and you can swap stuff when needed but I understand that for new people it's nice to have everything integrated when starting out. Still seems like most people write separate backend and Nest.js is most popular. I am not a biggest fan yet personally.
- avaldez_ 4y agoHow so? Nextjs only offers ssr and routing. Nothing else. Not even close to the full stack functionality you find in a default laravel or rails project.
- leerob 4y agoIt also has API routes and Middleware. But yeah, Laravel includes more by default. With Next.js, you need to pick a few more tools to go along with your stack. E.g. Next.js, NextAuth, Prisma, SQL database. You end up in a similar place, it's just not all part of the same package. That may or may not be beneficial for your team.
- brushfoot 4y agoAnd the advantage of Next is that you can leverage React components server side and client side, and share code between them. Laravel Livewire is pretty nice for basic interactivity, which is all many sites need, but React becomes useful as soon as you start needing app-like features. At that point, using Next, which is already plugged in to that ecosystem, is a very nice experience. Next is great for static sites, too, so nowadays I prefer putting my time into that vs. fragmenting between a more purely server-side framework like Laravel.
- kyriakos 4y agoInertiajs is the right solution if you need more interactivity than livewire. It can be used with react or vuejs out of the box (probably svelte too but haven't looked it up).
- 0xblinq 4y agoNext.js is great as long as what you're building is not much more than a landing page, or you're proxying to a real backend system (by another team, etc). Trying to build a "full stack" application with just Next.js is suiciding everyone that comes to the project after you leave.
- calvinmorrison 4y agoWere building some internal tools for customer service on Laravel's Orchid package and its the first truly RAD I've had in php that doesn't hold me back. Building interfaces is a pain and I lost touch with Javascript a decade ago, but it handles all of that for you. Highly recommend
- spiderfarmer 4y agoI'm rebuilding an old online community / forum in the TALL stack. It's awesome. I do have to do a lot of raw sql query building to keep it performant though.
- BuckyBeaver 4y agoSo do you just not use Laravel’s ORM?
- spiderfarmer 4y agoI do use it, but for some of the more complex queries I use the Raw SQL part of it.
- BuckyBeaver 4y agoOK, good to know that you can do both.
- francislavoie 4y agoIt has a full-fledged query builder: https://laravel.com/docs/9.x/queries https://laravel.com/docs/9.x/queries
- stef25 4y agoIt's possible to combine query builder, orm and raw sql any way you want
- waffl 4y agoAlso inertia.js just reached 1.0 and has been really fantastic to work with.
- BuckyBeaver 4y agoLooking at the Laravel site, I’m concerned about Laravel’s reliance on an ORM. Not only because ORMs are widely derided, but because I have a legacy MySQL DB and PHP 5 project I want to resurrect. I’m down to rewrite the server, but how do I restore a database full of user data with Laravel?
- spiderfarmer 4y agoWhat I'm doing is recreate everything the Laravel way and worry about importing the data (millions of pictures, videos and comments) later. I figured that once I'm proficient at Laravel that writing some import jobs would be relatively easy.
- BuckyBeaver 4y agoThanks! That’s happens to be just what I need to do: import pictures and related data.
- cellover 4y agoDoes your DB have a classic design? You can very easily map an existing DB with a fresh Laravel install, just write a couple Models, their relationships and you're almost set. I have been working with Laravel on a daily basis since 6 years and have never felt more efficient with code.
- BuckyBeaver 4y agoNot sure what you mean by classic, but I designed it manually to be queried with plain SQL. So I suspect the answer to your question is yes. Thanks for the info!
- cellover 4y agoBy classic I mean something somewhat standardized like user table: id, name, email ; post table: id, user_id, content etc.
- tasuki 4y ago> [Laravel]'s the greatest web framework to ever exists Back when I worked with PHP, we used Symfony and several coworkers very much looked down on Laravel. Symfony was modular and you could easily switch whichever component for your own by just implementing the interface and overriding the dependency injection thing. Word was that Laravel hardcoded many things and was less customisable. What is your take on this? In what way is Laravel superior to Symfony?
- iillexial 4y agoLaravel is great for prototyping and fast building. If you want to make a big application with Laravel, it's better to use Symfony-like approach with interfaces and DI (you can do it by using Laravel). What I personally do not like in Laravel is their ORM, too much magic calls involved.
- kugelblitz 4y agoYes, the magic involved in Eloquent ORM, also the central use of Facades or that the models are based on migrations (which uses code comments as a crutch for auto-completion), instead of the migrations being based on the models (how Symfony uses simple PHP objects, from which then Doctrine generates the "missing" migrations). I can live with both frameworks, but Symfony just feels cleaner and more transparent in its workings without using magic to make things look simpler.
- kugelblitz 4y agoThis is the big reason I use Symfony for most of my projects. I do lots of refactoring and modernizing of legacy or non-scalable codebases as a freelancer; with Symfony you can replace it module by module and slowly implement the Symfony framework structure. Through some configs, it can do dependency injection, event listener stuff, etc, but the framework is mostly glue around components. With Laravel, you need to go "all-in", and you had to do things the Laravel way. If I strayed from that path, it would make things really difficult. I still work on projects with either of the frameworks, but if I had a choice, it would almost always be Symfony.
- 4y ago
- martin_drapeau 4y ago+1 Laravel. Built-in queues is a killer feature that makes your Web App scale with little pain.
- bakugo 4y agoLaravel is great if you just want to get something simple done as fast as possible with the simplest, most elegant (at a glance) code possible and don't care at all about understanding how it works, what's going on under the hood, performance, doing anything the devs didn't expect, etc. Everything in Laravel is as obscured, "magical" and opinionated as possible for the sake of making the code "beautiful" (again, at a glance) to the detriment of basically everything else. I really have no idea how any experienced programmer can look at it and think it's usable for anything beyond the most simple project. The mere fact that models are PHP classes but none of their properties that exist in the database are actually declared as properties in the class because the ORM just "magically" puts them there at runtime should be enough to drive away any sane person. And let's not forget the amazing "Facades" a.k.a. glorified global variables filled with magic methods that you're expected to make extensive use of.
- pocketsand 4y agoCan you give me a few real life examples where you got bit by the "magic" conventions or ran into any serious issue from not explicitly setting properties on your models? Facades are not global glorified variables with magic methods. Usually they're just a way to instantiate and access a class with less code. People complain that facades limit testability. In fact, they're easily mocked. Etc. The docs do a very good job of explaining how things work and how you can override any "magic" you may not like. If something is doing something you didn't expect, you probably didn't read the docs. In fact, a delight of working with Laravel is it's so intuitive that you can often guess how to achieve something and be right. Have you worked with Laravel in practice?
- bakugo 4y ago> Can you give me a few real life examples where you got bit by the "magic" conventions or ran into any serious issue from not explicitly setting properties on your models? I shouldn't need "real life examples" to explain why using objects with magic dynamic properties instead of declaring the properties on the class is stupid. If I can't look at a model class and know what properties and methods it has, why is it even a class? With all the improvements made to PHP in the past decade, it feels like going back to the days when I was just using associative arrays to represent database objects. > Have you worked with Laravel in practice? Yes, I tried using it, was immediately put off by the issues I've described, then tried Symfony and never looked back. For every piece of dumb nonsensical magic Laravel does, you can look at Symfony to see how it should be done properly.
- dgb23 4y agoLaravel is a decent web framework, that comes with batteries included and _often_ has sensible ways to override and avoid things if you don't want them. For example, you don't need to use the ORM at all and can just use their query builder (which is pretty good). It's there if you want it, but the framework works happily without it and doesn't get in your way in that regard. I inherited a Laravel codebase from a previous contractor and it was reasonably ergonomic to navigate and extend, because I was able to lean on the framework documentation to understand how it all worked. But there were several points where it was _not_ reasonable, because of Laravel/PHP magic and those were pretty painful to figure out and debug. The reason I wouldn't choose it myself anymore is the magic, the little surprises and hard to debug idiosyncrasies that it provides in order to look pretty. Also generally Laravel, PHP and related ecosystems are moving too fast and are difficult to keep up to date without breaking and/or misunderstanding things. It's not quite JS/npm level of churn, but unnecessary regardless. A more minor point is the baseline performance tends to be on the lower end of what I need. There are ecosystems out there that value stability and clarity more and provide better tools to test and debug the code if necessary, and I've come to appreciate those things much more with experience than other factors such as reducing the initial development time.
- chris1993 4y agoWhat are your preferred alternatives to Laravel?
- dreadnip 4y agoSymfony is more explicit, configurable and has way less magic.
- 0xblinq 4y agoWhat other ecosystems and frameworks are you talking about? I've tried many things across many ecosystems in the last 20+ years and so far, despite any drawbacks it could have Laravel is the best one by a long shot. So I'm curious what those other better solutions you mention are and what are its trade offs.
- hk1337 4y ago> even better than Rails IMHO. I don't know about that. I have been looking at Rails 7 and there's a lot things in Rails now I like better than Laravel. Symfony did most of the heavy lifting with getting PHP relevant again, Laravel was just better at marketing. Laravel is good, don't get me wrong but everyone seems to think Laravel is the only good thing in PHP and a lot of Laravel is built with Symfony libraries.
- okeuro49 4y ago> If you are thinking about building a web application, take a look at Laravel. Take a look at Symfony before Laravel. It will be very similar to Java developers who are familiar with Spring.
- kakuri 4y agoI spent a week learning Laravel and modern PHP for a project that never materialized. I am so grateful the project never materialized, because for all the past 2 decades of improvement PHP remains a language I never want to work with. There may be some details in "A Fractal of Bad Design" that no longer apply, but the phrase itself still very much applies - PHP (and Laravel) remain a fractal of bad design.
- ofrzeta 4y ago- Laravel has many "admin libraries" (Voyager, Orchid, Filament, Twill, Backpack, ...), some of them open core, each with their own idiosyncrasies. Symfony has EasyAdmin. - Laravel uses Inertia for Vue.js or React integration while Symfony has an integrated solution with Symfony UX - Symfony has become more modular with Symfony Flex - Symfony has put a lot of effort into improving "developer experience" in the Symfony DX initiative - Symfony has brillant docs in many languages including a new open book by Fabien Potencier and other Symfony collaborators