Laravel 9

It’s not officially release yet. It was originally scheduled to be released around September this year, but the Laravel team decided to release back to January 2022. Lets see what kinds of features might include in Laravel 9.

PHP Version

Laravel 9 requires Symfony 6.0 and has a minimum requirement of PHP 8,so I think the same rules will apply to Laravel 9.

Anonymous stub migrations

Laravel 8.37 announced a new feature called Anonymous Migration that avoids migration class name collisions.

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
 
return anoyclass extends Migration {
 
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('table', function (Blueprint $table) {
            $table->string('column');
        });
    }
};

A tidy design for routes:list

The route: list command has been in Laravel for a long time, and the problem I sometimes encounter is that if you have defined large and complex routes, trying to view them in the console can be complicated.

Screenshot 2022-01-05 at 13 57 23
Image credit: nunomaduro

New Query Builder Interface

Laravel 9 has a new QueryBuilder interface developed by Chris Morrell and you can see here for all the details.

For developers who rely on type hints for static analysis, refactoring, or code completion in their IDE, the lack of a shared interface or inheritance between Query\BuilderEloquent\Builder and Eloquent\Relation can be pretty tricky:

return Model::query()
  ->whereNotExists(function($query) {
    // $query is a Query\Builder
  })
  ->whereHas('relation', function($query) {
    // $query is an Eloquent\Builder
  })
  ->with('relation', function($query) {
    // $query is an Eloquent\Relation
  });

SwiftMailer to Symfony Mailer

Swift Mailer has been deprecated in Symfony and Laravel 9 will switch to using Symfony Mailer for all mail transport.

PHP String functions

Although PHP 8 will be the minimum, you can still use PHP string functions, str_contains()str_starts_with() and str_ends_with() internally in the \Illuminate\Support\Str class. You can check here for more detail.

There might be still many featuers going on and I guess laravel 9 is coming soon. When it releases, I might probably write another article relating with this.

Yuuma



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム