Did Laravel 11 REALLY join the party???
Hello LinkedIn community!??
?
Since we had a phenomenal rendezvous with Laravel 11 in in the last article, I thought we could heat things up by talking a bit more about the new version which introduces a couple of commands that are lifesavers and really handy to use.
1. - 2. php artisan install:api and php artisan install:broadcasting - Fortunately, the space-consuming api.php and channels.php route files are no longer present by default, as per documentation (https://laravel.com/docs/11.x/releases), and have been replaced by these 2 new commands which are easy to use (but, don’t worry if you need them, these 2 commands are still available)
3. php artisan make:class – Introduces the option to generate PHP class. Optionally, you can add ‘-- invokable’ to make an invokable class. Since Laravel 5.6, you can use invokable for classes (or controllers) that are responsible for performing only one specific task
4. php artisan make:enum – Allows quick generation of Enum (enumerated type) classes. Enum classes have been natively supported by PHP since version 8.1. And for those of you who may be less or unfamiliar with Enums, they are special classes that represent a fixed set of values. Additionally, you can provide ‘-- string’ or ‘-- int’ to mark (if the values inside the Enum class are a string or integer)
领英推荐
5. php artisan make:interface – Like the one above, this allows the quick generation of Interface classes. Let’s remember, interfaces are a set of methods that a class must implement, without specifying how these methods should behave
6. php artisan make:trait – Gives us the opportunity to make Trait classes – those of us who don’t like to duplicate our code, and prefer to reuse existing methods, consider this function to be our best friend
Exclusively for Artisan commands 3. through 6. above, there are additional options, which you can access by adding ‘-- help’ at the end of the commands.
If you liked what you read in this article, you can find more in my previous one (https://tinyurl.com/4yr59kft) or you can read the full documentation on your own here (https://laravel.com/docs/11.x/releases)
Let's heat up our Laravel projects??