News for hackers. Stuff that matters.
Re:Laravel 9 by chipotle_coyote on Tuesday February 08, 2022 @01:38PM (#30262505)
Personally, I liked Laravel when I was first investigating it years ago, but was always a touch put off by the pervasive "I am beautiful, adore me" undercurrent throughout its design, documentation, and even comments. I'll be the first to admit that's not a rational critique.

Having said that, though, Laravel is relatively unusual among major frameworks in that it doesn't seem to have been developed in tandem with a real-world project like Rails and Django were (e.g., BaseCamp and the Lawrence World Journal's internal CMS), but rather developed just to be "a better framework." Each successive release of Laravel seems to push even harder at tying you up with other Laravel add-ons, some of which are paid services. Rails and Django are open-source projects, but Laravel is an open-source product. Again, not necessarily bad, but there's an increasing feeling that the Laravel commercialization model is "give us sufficient money and you'll barely have to write any code."

My other nitpick with Laravel is that learning to develop with it is often learning to develop specifically for Laravel rather than learning to develop for PHP. This is a charge leveled against Rails and Django, too, but Python and (perhaps especially) Ruby are just better languages for developing DSLs in. Laravel has to jump through a lot of hoops behind the scenes to do what it does, leaving you with a framework that isn't particularly nimble and design patterns that often aren't particularly applicable to the rest of the PHP world.

If you're willing to hop fully on board with the Laravel train, none of this may be an issue for you. But at this point I'm not convinced that smaller PHP projects, at least, might not be better off without frameworks at all. Use Composer to pull in specific packages that you really need, and ask "if I can get the functionality I need from this package with an afternoon's work, is the package bringing anything to the table that I still want" before adding them. (Sometimes the answer is "yes," but not always, and I tend to be wary of packages that primarily just wrap other packages.)

Re:Laravel 9 by igammarays on Tuesday February 08, 2022 @03:52PM (#30264522)
> Laravel has to jump through a lot of hoops behind the scenes to do what it does, leaving you with a framework that isn't particularly nimble and design patterns that often aren't particularly applicable to the rest of the PHP world.

And tell me, do you use React? Talk about jumping through hoops just to print HTMl.

Personally I'm very glad Laravel was written in PHP, because:

1) you can still use raw PHP in the templates if you wish.

2) PHP Traits allow a very interesting form of polymorphism and code-reuse which is especially suited to the kind of business logic you find in web apps.

3) PHP is very much a C-inspired language that was built ONLY for the web, so you get access to a lot of low-level constructs and a "baremetal" paradigm (passthroughs like system() for bash scripts with seamless handling of STDIN/STDOUT) plus a solid standard library for the web. The PHP standard lib supports everything you need to write HTTP servers: curl_setopt, parse_url, FFI for calling C functions for performance-sensitive code, date/time/number/currency formatting, global variables for cookies and sessions, etc. all out of the box.

For web apps, I'll take PHP over NodeJS/Ruby/Python any day of the week.

Re:Laravel 9 by chipotle_coyote on Wednesday February 09, 2022 @01:11AM (#30269506)
Your response reads to me like you think I was dunking on PHP, but I wasn't. I don't feel like PHP is a particularly great language to write a DSL-style web framework in, but that's largely because -- as I was trying to suggest with the part about "Use Composer to pull in specific packages you really need" -- modern PHP mostly just doesn't feel like it needs a framework to me. That's precisely because, as you put it, PHP was built ONLY for the web, and the language's earlier quirkiness has really been smoothed over in the last decade. I like PHP. We are closer to being in agreement than you may think. :)

(Although I might take Ruby over PHP, depending on specific circumstances. Ruby is just such a nice language, and Rails has gotten pretty darn good once it stopped being "interesting" and could settle down to making itself productive. Maybe that will one day happen with Node…)

Re:Laravel 9 by unfocussed_mike on Tuesday February 08, 2022 @02:14PM (#30263057)
> but was always a touch put off by the pervasive "I am beautiful, adore me" undercurrent throughout its design, documentation, and even comments. I'll be the first to admit that's not a rational critique.

I should add, separately, that after a long career in web-development, this kind of reflexive emotional response strikes me as practically a survival instinct, so I am not judging you for it at all.

Re:Laravel 9 by munk-a on Tuesday February 08, 2022 @01:53PM (#30262735)
If you want to talk about potentially irrational reasons to be put off Laravel: when picking a framework I ended up going with Zend over Laravel mostly due to the modularity of the former... but also because the wide prevalence of Laracasts made me concerned that written documentation would be difficult to use and the documentation space of the framework would slowly migrate to being half-out-of-date video and audio snippets that slowly became more and more misleading and inapplicable without being updated due to a lack of motivation.
Re:Laravel 9 by tnorthcutt on Tuesday February 08, 2022 @02:04PM (#30262904)
FWIW that hasn't been my experience at all. The documentation is great and well maintained. The repo is public and you can see all changes here: https://github.com/laravel/docs
Re:Laravel 9 by munk-a on Tuesday February 08, 2022 @02:14PM (#30263064)
I made this decision about four years ago and while the documentation was well maintained at the time I was concerned that the Laracasts would be unmaintained and become a source of confusion that talked about no longer present features. I was mostly afraid about the primary problem with over-documentation: you're introducing a maintenance cost which, if you ever stop paying, ends up quickly causing more harm than never having had the documentation in the first place.

Here[1], for instance, is someone in this very response thread talking about how the core getting started Laracasts are out of date and they're confused which documentation they should reference. This will probably be addressed pretty soon (see the comment) but I think this is a very real danger with promising to deliver non-text based documentation.

1. https://news.ycombinator.com/item?id=30261801

Re:Laravel 9 by hhda on Tuesday February 08, 2022 @03:00PM (#30263752)
Laravel 9 was released today (hence this thread) - Laravel 8 is the major version that came out directly before Laravel 9. Further, Laravel 9 is essentially Laravel 8 with a bump to the dependencies, with most higher impact changes coming as a result of those dependencies being updated[1]. The Laravel 8 From Scratch series has videos as recently as August[2], with the What's New in Laravel 9 series already having 11 videos[3], with the most recent posted yesterday. The Laracasts video series are still very much actively updated (with Jeffrey, who runs it adding new teachers in the last year).

And Laracasts is a 3rd party learning resource anyway, with the first party docs all being well maintained.

1. https://laravel.com/docs/9.x/upgrade

2. https://laracasts.com/series/laravel-8-from-scratch/episodes...

3. https://laracasts.com/series/whats-new-in-laravel-9

Re:Laravel 9 by munk-a on Tuesday February 08, 2022 @04:47PM (#30265241)
I think it's safe to view Laracasts as being "sold" as part of the documentation officially accessible - and documentation should be ready before a release is pushed into public release. I absolutely sympathize if I've got the wrong impression of Laracasts (though maybe they should be less frequently promoted by Laravel itself if that's the case) and I completely understand that it takes time to record updated audio-visual tutorials... but that's exactly the sort of thing I'm talking about - those prominent audio-visual tutorials existing and being pretty officially associated with Laravel means that new users trying to learn the system have windows where the documentation is confusing and out of date.

It seems like an unnecessary risk to have adopted given that it's not at all standard in the industry - sometimes language designers will give a version specific tutorial but they're understood to be unmaintained with the docos being the official source... Laracasts are a very different thing which appear to be mostly working, but seem really likely to dramatically and suddenly become more of a danger than a benefit.

One parallel I would draw on is the community effort, when PHP 5.3 or 5.4 came out, to purge all the terrible advice from StackOverflow. PHP had an issue, its documentation on php.net was fine and followed best practices, but the StackOverflow answers were often _terrible_ like - this will cause a big gaping hole in your security instantly terrible. It took a significant amount of effort to delete or properly answer these sources and since that happened the reputation of PHP has hugely improved. Bad documentation existing is worse than no documentation existing (but please don't take this as an excuse to not comment your code, just be conservative in your comments and keep it to a level you can actually afford to maintain).

Re:Laravel 9 by stef25 on Tuesday February 08, 2022 @03:47PM (#30264452)
Are there any decent docs for Zend at all? I struggled with it for years. Simple "how do I ..." questions would just bring up nothing. Not from the docs, nor anywhere else on the web. Any solution I'd find wouldn't work in my case because other parts of my app were built in some incompatible way.

The Laravel docs on the other hand are the best I've ever seen and there's a huge amount of community driven guides that are mostly decent too.

Re:Laravel 9 by munk-a on Tuesday February 08, 2022 @04:29PM (#30265006)
Zend has had some issues in that Zend1 and Zend2 were essentially different frameworks since Zend1 was built before namespacing was implemented. Whenever googling I'll include zf1, zf2, zf3 or laminas in the query to make sure I'm looking at the right version. The official documentation[1] itself is pretty good and has been since zf2 though, since laminas/zend has always been extremely modular, there aren't a lot of assumptions around what other components you're using, so most of the component documentation is pretty self contained. There are also resources like the skeleton application[2] that can be good places to begin if you're starting fresh.

1. https://docs.laminas.dev/

2. https://docs.laminas.dev/tutorials/getting-started/skeleton-...

Re:Laravel 9 by chipotle_coyote on Tuesday February 08, 2022 @02:07PM (#30262937)
That's not super irrational. :) Laravel does seem to be keeping up with their written documentation, although it's also occasionally an example of their "See how great Laravel is? See? See?" style.
Re:Laravel 9 by unfocussed_mike on Tuesday February 08, 2022 @01:44PM (#30262592)
FWIW I have never once interacted with Laravel's commercial model, or felt that I am being engineered into it. I just don't give it another thought.
Re:Laravel 9 by chipotle_coyote on Tuesday February 08, 2022 @01:59PM (#30262820)
I haven't interacted with it, either. "Engineered into it" would be too strong a phrasing, but it's hard not to get the impression Laravel's creator(s) really, really want you to use their other services. I mean, compare the menu bars of rubyonrails.org, djangoproject.com, and laravel.com: Rails's first links are "blogs" and "guides"; Django's first links are "overview" and "download"; Laravel's first links are "Forge" (their commercial provisioning service) and "Vapor" (their "serverless" deployment platform).
Re:Laravel 9 by unfocussed_mike on Tuesday February 08, 2022 @02:09PM (#30262977)
I take your point and I understand that you could get that impression looking at the website; they have stuff to sell.

There's also more of a market for some of that stuff, and the reason is the huge proliferation of different PHP execution environments. PHP runs in more places and there are more opportunities to help correct for the limitations of those environments (with log monitoring tools and the like).

(Also -- contrarywise as they say -- PHP does _not_ run first-class in some serverless environments; you need a custom execution environment for PHP in Lambda. So there's an opportunity there.)

But as a developer experience it is really not commercialised at all. I do not look at or think of any of those things, and I've not encountered any significant upselling. I'd forgotten all about Forge until you mentioned it! (And will now revisit it)

Re:Laravel 9 by tylerlwsmith on Wednesday February 09, 2022 @03:57AM (#30270507)
This is totally fair. A few years back I worked on a Laravel project when both me and the other dev were fairly new to Laravel, and neither of us were particularly adept sysadmins. Forge was a life-saver when it came time to deploy.

Now that I'm _much_ more experienced with Linux server management, I found a mix of Laravel's official deployment docs and some community tutorials more than enough to spin up my Laravel apps on Digital Ocean.

I think that Laravel providing Forge as an official happy path for deployment is to the benefit of newer Laravel developers. I've listened to the hosts of the Django Chat Podcast lament about deployment being a big hurdle for newer Django developers. I'm glad that Laravel has an easy button. As someone who is now more experienced, I'm also glad that I don't feel forced to use Forge and other services by the Laravel team. I might use it again at some point though.

Re:Laravel 9 by jonwinstanley on Tuesday February 08, 2022 @03:09PM (#30263879)
Disagree mostly. I’ve never paid for any of the paid modules and continue to use Laravel on a daily basis.

I do feel the docs are a little minimal at times, maybe to make them prettier? Could definitely benefit from a little more explanation in places.

Re:Laravel 9 by fendy3002 on Tuesday February 08, 2022 @04:54PM (#30265323)
> I'm not convinced that smaller PHP projects, at least, might not be better off without frameworks at all

Uh having experienced the old pre-codeigniter php, I don't really recommended it. Without proper controller separation (using twig as rendering engine for example) it poses the risk for the business logic to be tangled with view.

Not to mention that it's hard to do routing with native php, except the simple [folder-path]/[php-filename].php and remove the extension requirement with .htaccess.

At that point I recommend to just use a framework instead, though arguably Laravel may be too big for some. I don't know if PHP has similar framework like expressJs though that just handle the minimum requirements.

Re:Laravel 9 by chipotle_coyote on Tuesday February 08, 2022 @06:53PM (#30266589)
> Without proper controller separation (using twig as rendering engine for example) it poses the risk for the business logic to be tangled with view.

Well, you should also quote the part in my comment about "use Composer to pull in specific packages that you really need." :) I'm not suggesting "roll everything on your own," necessarily: if you want to use Twig, or another templating engine, add that as a Composer package. (Personally, I'd just write a small pure PHP template class to handle this and trust myself not to be a dingus, but if I were on a team that might change the calculus here.)

> Not to mention that it's hard to do routing with native PHP...

Again, you don't have to roll your own here; you can include something like FastRoute or even Symfony's router as a routing engine.

I'm not saying you should avoid absolutely all libraries. Laravel is built on top of a lot of Symfony libraries, after all! For a project I've been noodling with slowly, I'm using my own "pure PHP" template engine, but I'm using FastRoute for routing, Doctrine DBAL (although not the ORM) for database access, Monolog for logging, PHP Debug Bar to get a lot of debugging info in development, etc.

Re:Laravel 9 by fendy3002 on Tuesday February 08, 2022 @09:02PM (#30267717)
Okay that's a fair approach, though it's still not recommended for everyone especially those who isn't much familiar with those packages setup.
Re:Laravel 9 by tored on Thursday February 10, 2022 @07:16AM (#30285116)
It is quite obvious that Laravel is written by an American, they all do understand marketing better than us Europeans, Artisans creates works of art and it is eloquent even if it isn't.

What is great about Laravel is all the addons you can apply seamlessly.

But I can't say I like the overall design, too much magic for my taste and all the non-strict typing. Put things in the correct directory and things happen is generally a bad design. Use magic name on class object either as a property or a function and different things happen.

I do understand that it is easier for the framework developer to have loose typing, easier to swap implementations between major versions, but it makes it harder for the framework user. I have to, at least in older Laravel versions, apply a lot of annotations to get a pleasant developer experience.

In every Laravel project I haven been involved in I have needed to read the Laravel framework source code with all its layers to get grip what is actually going on and how it is related to my specific problem. However this have been true for every framework project I have been involved in, Laravel or not.

Re:Laravel 9 by dabernathy89 on Tuesday February 08, 2022 @03:14PM (#30263959)
> Laravel... doesn't seem to have been developed in tandem with a real-world project

> other Laravel add-ons, some of which are paid services

These other services are what you're looking for - that's how Taylor and the team dog-foods Laravel.

While I don't object at all to the claim that small PHP projects can easily be done w/out a major framework, it's worth noting that both many components of these frameworks (including Laravel) can be incorporated into a smaller project ad hoc.

Re:Laravel 9 by tnorthcutt on Tuesday February 08, 2022 @02:01PM (#30262853)
Just for some context, here's how the items under "Ecosystem" on laravel.com break down on free vs. paid:

Free:

- Breeze

- Cashier

- Dusk

- Echo

- Horizon

- Jetstream

- Mix

- Octane

- Sail

- Sanctum

- Scout

- Socialite

- Telescope

- Valet

Paid:

- Envoyer

- Forge

- Nova

- Spark

- Vapor

Re:Laravel 9 by chipotle_coyote on Tuesday February 08, 2022 @02:15PM (#30263069)
You left out Nova, which is also paid.

I don't want to come across as "nobody should give Laravel money," to be clear. I'm just observing that Laravel is essentially a commercial open-source enterprise in a way that Rails and Django aren't. Models like this seem to be a bit more common in the PHP world. (e.g., Sensio Labs makes their money by teaching and consulting on Symfony, Laravel LLC makes money from Laravel add-on services, but Basecamp makes money from the SaaS applications they're building on top of Rails and is not trying to monetize Rails itself.)

Re:Laravel 9 by unfocussed_mike on Tuesday February 08, 2022 @02:19PM (#30263144)
Rails very much was a commercial open source enterprise when it started out.

It's just that the enterprise was Basecamp and the other 37 Signals apps. They benefited enormously from the extra eyeballs on their framework, not least during the infamous "hey, we built this massive web framework in part around the incorrect assumption that GET requests don't need to be idempotent and then encouraged everyone to use it" time.

They had no services to sell but they had a keen commercial imperative.

Re:Laravel 9 by porker on Tuesday February 08, 2022 @02:45PM (#30263531)
> not least during the infamous "hey, we built this massive web framework in part around the incorrect assumption that GET requests don't need to be idempotent and then encouraged everyone to use it" time.

Tell me more. I remember when Rails was first released but missed that entire saga.

Re:Laravel 9 by unfocussed_mike on Tuesday February 08, 2022 @03:13PM (#30263949)
It is so long ago now that I can't even find stuff about it on Google -- 2006 I think?

Basically, well after they'd released the framework they had to change the Rails scaffolding (and I think their own apps) because parts of the scaffolding (CRUD deletes) would use GET to do the action that should only be done as POST. They discovered it about the time link-prefetching was invented ;-)

Basically, browsers were pre-fetching all the clever scaffolded delete URLs and destroying records, seemingly at random.

I was really impressed with Rails at the time but stayed well away from the scaffolded code in production, and I was gobsmacked by the idea that people talking about a clever, opinionated framework that did the right thing and produced magical, clean, elegant code to rescue you from terrible alternatives did not understand that GET requests should be idempotent.

Edit: here is one bit about it:

https://dhh.dk/arc/000455.html

The unearned high-mindedness of this still makes me chuckle.

Re:Laravel 9 by tnorthcutt on Tuesday February 08, 2022 @02:44PM (#30263510)
You're right, thanks! Edited to add Nova (which I think is a fantastic product, and is worth far more than the $199 it costs).
Re:Laravel 9 by chipotle_coyote on Wednesday February 09, 2022 @01:14AM (#30269537)
I admit my initial thought looking at Nova was "this is free with Django!", but I'm pretty sure Nova does a lot more. :) (Django's automatic admin interface still had a distinct "state of the art for 2006" vibe the last time I looked, although to be fair it's been a few years.)
Re:Laravel 9 by blueside on Tuesday February 08, 2022 @04:04PM (#30264679)
for $199, you'd think Nova would be mobile friendly. Maybe this has changed? When we tried it last year, we were quite shocked it had no responsive design support.
Re:Laravel 9 by aprdm on Tuesday February 08, 2022 @02:09PM (#30262972)
This gives absolutely no context as I have no idea what these funny names are :)
Re:Laravel 9 by jw1224 on Tuesday February 08, 2022 @02:20PM (#30263158)
Free:

- Breeze: authentication starter kit

- Cashier: payment processing through Stripe or Paddle

- Dusk: automated browser testing

- Echo: real-time broadcasting

- Horizon: queue handler

- Jetstream: application scaffolding

- Mix: frontend asset compilation

- Octane: serverless Laravel

- Sail: Laravel Docker environment

- Sanctum: SPA authentication

- Scout: search engine

- Socialite: OAuth provider authentication

- Telescope: application monitoring

- Valet: macOS developer environment

Paid:

- Envoyer: zero-downtime deployment service

- Forge: Laravel hosting via AWS, DigitalOcean, and more

- Spark: application scaffolding kit

- Vapor: serverless Laravel hosting via AWS

Re:Laravel 9 by unfocussed_mike on Tuesday February 08, 2022 @02:16PM (#30263093)
I've just realised that a) I've used precisely none of them, and b) Passport isn't even on the list!

I really do need to look at all of this stuff again, because I'm very open to not running my own VMs/services for a couple of apps.

Re:Laravel 9 by ksec on Thursday February 10, 2022 @04:04AM (#30283894)
>Laravel commercialization model is "give us sufficient money and you'll barely have to write any code."

I actually think this is a good direction. Working its way backward to Low-Code.