🗑️

Laravel 9 features

  1. You have to have PHP version > 8
Brief
Laravel 9 has introduced several new features and improvements. Some of the main features of Laravel are:
  1. Anonymous stub migration feature which eradicates issues related to class name collisions instantly1.
  1. New Query Builder Interface which makes it easier for developers to work with2.
  1. Improved themes on an exceptional page which allows you to customize or choose available themes at your convenience3.
Here’s an example of how you can use the new Query Builder Interface:
use Illuminate\Support\Facades\DB; $users = DB::table('users') ->where('name', 'John') ->orWhere('name', 'Jane') ->get();
In this example, we’re using the DB facade to query the users table and retrieve all users whose name is either “John” or “Jane”. The get() method returns a collection of user objects.
Learn more:

New Functionalities

1. Symfony Mailer

  • Previous releases of Laravel utilized the Swift Mailer library to send outgoing emails.
  • Now Symfony Mailer is used as an internal library
  • But wrapper and furvtions are still same

2. FlySystem 3.x

  • Laravel 9.x has migrated from Flysystem 1 .x to 3.x. Under the hood,
  • Flysystem powers all of the file manipulation methods provided by the Storage facade.
  • But wrapper and functions are still same

3. Improved Accessors and Mutators

  • In Laravel 9.x you may define an accessor and mutator using a single, non-prefixed method.
public function name ( ) : Attribute return new Attribute ( get: fn ($value) => strtoupper ($value) , set: fn ($value) => $value, ); }
  • Now we can use the same function to use in Accessors as well as Mutators

4. Controller Route Groups

  • In previous version every time defining the route for the controller we have to write the controller_name:: class and with function name
  • But in this version we can group the controller route
notion image

5. Full text Indexes / Where Clauses

When using MySQL, the fullText method may now be added to column definitions to generate full text indexes:
$table—>text ( 'bio' ) —>fullText ( ) ;
The whereFullText and orWhereFullText methods may be used to add full text "where" clauses to a query for columns
$users = DB::table('users') ->whereFullText('bio', 'web developer')->get();

6. Inline Blade template

suppose you have to generate a very small html template , so no need to create a view file instead you can write inline blade template
notion image

7. Checked or Selected Blade Directives

notion image

8. Bootstrap Pagination View

notion image

9. Implicit Route Binding

If you want only specific or predefined values can be able to be searched then you can define the enum such that
notion image
here the category can be either fruits or people
 

10. test coverage

while testing your site you can now view the percentage of complition of the process
notion image

11. New Helpers

notion image