News for hackers. Stuff that matters.
Re:Union Types have been accepted for PHP 8 by idoubtit on Saturday November 09, 2019 @04:57PM (#21494676)
PHP has come a long way, and nowadays it's in the same category as Python. Worse in many ways, but better by other, like the type declarations and their (runtime) enforcing.

Yet there are still many ugly sides to PHP, and Laravel illustrates most of them. There is so much magic that IDE can't follow: some classes have a `__call()` magic function that redirect methods calls to other instances. Some functions return values of varying types, with no common interface.

I've worked with several PHP frameworks, and Laravel is by far the worst. Its awful documentation plays a big role in this (no real reference doc, just a tutorial ; no links to classes or function in the doc ; the API doc is a joke ; the acclaimed "laracasts" are useless for serious work). The fact that this framework is dominant in the PHP community is worrying.

Re:Union Types have been accepted for PHP 8 by thdrdt on Saturday November 09, 2019 @05:50PM (#21495037)
Laravel is popular because it allows you to setup your project very quickly.

And then the trouble starts. Remember what properties your models had? No? Well so doesn't your IDE. There is just too much magic going on to keep things maintainable.

If you like a framework like Laravel you should go with Symfony instead. But don't use annotations. Keeps things separated so you and your colleagues can find routing and database information at logical places instead of all over the place in classes.

Re:Union Types have been accepted for PHP 8 by xellisx on Saturday November 09, 2019 @08:17PM (#21495728)
Laravel, from my own experience is full of deep rooted magic, and assumptions. Also it throws SOLID out the window.

We use Symfony at work and we turned off the annotations package, use XML mapping for our models.

Of course, Symfony and Doctrine do have some frustation points.

Re:Union Types have been accepted for PHP 8 by thanato0s on Tuesday November 12, 2019 @12:32AM (#21511771)
I have the same experience. Laravel is way too magical for me.

I use Symfony for quite some time and at one point I stopped using Doctrine data mapper. The DBAL and the query builder are enough.

Re:Union Types have been accepted for PHP 8 by xellisx on Tuesday November 12, 2019 @07:11AM (#21513444)
If it were up to me, it would all be SQL queries. Maybe even use the library I rebuilt - https://github.com/ellisgl/GeekLab-GLPDO2
Re:Union Types have been accepted for PHP 8 by kyriakos on Saturday November 09, 2019 @08:08PM (#21495684)
For model properties and a few other IDE related issues with laravel you can use ide helper which generates annotations on your models by inspecting the schema in the database. The ide then uses the annotations and gives you property auto complete among other things.

https://github.com/barryvdh/laravel-ide-helper

Re:Union Types have been accepted for PHP 8 by melicerte on Sunday November 10, 2019 @04:42AM (#21497272)
I would recommend you to give Yii[0] a try. It is a solid, consistent and well thought framework with a vey good documentation. Unfortunately, It has always been eclipsed by new kids on the block frameworks like Laravel but really deserve more credits (provided you accept to let some of the laravel magic go).

I work for a web development company and We have been successfully using Yii for years now, including for medium size projects (in terms of LOC and exposure).

Just my two cents

[0] https://www.yiiframework.com

Re:Union Types have been accepted for PHP 8 by GeneralTspoon on Saturday November 09, 2019 @06:52PM (#21495366)
Regarding model properties - there’s a standard documentation syntax that can be used to document that and give you autocomplete in your IDE (Laravel IDE helper can also auto generate these for you).

Not ideal - since it’s not enforced in anyway (the same as local scope type doc declarations). But can be useful.

Re:Union Types have been accepted for PHP 8 by tylerjwilk00 on Saturday November 09, 2019 @08:12PM (#21495697)
I agree in regards to Larvel. It was a breath of fresh air in the early days but they have baked so much magic into it and break backwards compatibility constantly that I have long given up even considering it. I will second the recommendation for symfony [1]. It lets you compose your app of just what components you need instead of the everything and the kitchen sink approach. However, composable systems are my preference but may not be for everyone.

[1] https://symfony.com/

Re:Union Types have been accepted for PHP 8 by CodeWriter23 on Saturday November 09, 2019 @05:16PM (#21494801)
How long ago was your experience? I started using Laravel early last year, took a hiatus and have been actively developing in it for the past 7 months. This is coming from years with Perl Dancer / Dancer2. I have not run into these issues. But I have to admit my own bias in preferring the “show me how” instructional method over “tell me everything, no matter how esoteric”. I’ve also found Laravel superior to Dancer in every way. But I did have to get into a different mindset.
Re:Union Types have been accepted for PHP 8 by lone_haxx0r on Saturday November 09, 2019 @10:14PM (#21496169)
> But I have to admit my own bias in preferring the “show me how” instructional method over “tell me everything, no matter how esoteric”.

I don't think it's about preferring one approach or the other.

A good library/framework should have both instructional documentation and reference documentation. They have different use-cases and are not interchangeable.

Re:Union Types have been accepted for PHP 8 by cutler on Sunday November 10, 2019 @01:05AM (#21496668)
Comparing Dancer with Laravel is a bit apples to organges, no? Mojolicious or Catalyst would make a better comparison with Laravel.
Re:Union Types have been accepted for PHP 8 by dabernathy89 on Saturday November 09, 2019 @07:18PM (#21495496)
> Its awful documentation plays a big role in this

Laravel is lauded by many for its fantastic documentation. It's not comprehensive, but it's still pretty extensive, easy to read, and the gaps are only for niche situations.

As far as the API docs, what is your complaint about them?

Re:Union Types have been accepted for PHP 8 by kyriakos on Saturday November 09, 2019 @08:09PM (#21495688)
Where are the api docs?
Re:Union Types have been accepted for PHP 8 by peterkelly on Saturday November 09, 2019 @08:17PM (#21495727)
I know absolutely nothing about Laravel and haven't touched PHP in nearly 20 years - but within about 10 seconds on Google I found the following, which at first glance looks pretty comprehensive:

https://laravel.com/api/4.2/

Re:Union Types have been accepted for PHP 8 by tazard on Saturday November 09, 2019 @11:55PM (#21496465)
That is an old version, the current being https://laravel.com/api/6.x/ but I have to agree, I have found them to be great. There is no reference to the API docs from the main website though, which I have always found odd.
Re:Union Types have been accepted for PHP 8 by dabernathy89 on Monday November 18, 2019 @12:22PM (#21566123)
There is - I guess it's not super easy to find. But if you go to the main documentation page, it's under the "Prologue" heading.