{"id":11462,"date":"2022-01-24T10:00:00","date_gmt":"2022-01-24T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=11462"},"modified":"2022-01-24T12:19:37","modified_gmt":"2022-01-24T03:19:37","slug":"laravel-9","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/11462","title":{"rendered":"Laravel 9"},"content":{"rendered":"\n<p>It&#8217;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.<\/p>\n\n\n\n<h3>PHP Version<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<h3>Anonymous stub migrations<\/h3>\n\n\n\n<p>Laravel 8.37 announced a new feature called Anonymous Migration that avoids migration class name collisions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n \nreturn anoyclass extends Migration {\n \n    \/**\n     * Run the migrations.\n     *\n     * @return void\n     *\/\n    public function up()\n    {\n        Schema::table('table', function (Blueprint $table) {\n            $table-&gt;string('column');\n        });\n    }\n};<\/code><\/pre>\n\n\n\n<h3>A tidy design for routes:list<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" src=\"https:\/\/user-images.githubusercontent.com\/5457236\/148273199-895b7319-ba33-4a07-b73e-afec9314379f.png\" alt=\"Screenshot 2022-01-05 at 13 57 23\" width=\"840\" height=\"417\" \/><figcaption>Image credit: <strong><a href=\"https:\/\/github.com\/nunomaduro\">nunomaduro<\/a><\/strong><\/figcaption><\/figure>\n\n\n\n<h3>New Query Builder Interface<\/h3>\n\n\n\n<p>Laravel 9 has a new QueryBuilder interface developed by Chris Morrell and you can see <a href=\"https:\/\/github.com\/laravel\/framework\/pull\/37956\">here<\/a> for all the details.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>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&nbsp;<code>Query\\Builder<\/code>,&nbsp;<code>Eloquent\\Builder<\/code>&nbsp;and&nbsp;<code>Eloquent\\Relation<\/code>&nbsp;can be pretty tricky:<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>return Model::query()\n  -&gt;whereNotExists(function($query) {\n    \/\/ $query is a Query\\Builder\n  })\n  -&gt;whereHas('relation', function($query) {\n    \/\/ $query is an Eloquent\\Builder\n  })\n  -&gt;with('relation', function($query) {\n    \/\/ $query is an Eloquent\\Relation\n  });<\/code><\/pre>\n\n\n\n<h3>SwiftMailer to Symfony Mailer<\/h3>\n\n\n\n<p>Swift Mailer has been deprecated in Symfony and Laravel 9 will switch to using Symfony Mailer for all mail transport.<\/p>\n\n\n\n<h3>PHP String functions<\/h3>\n\n\n\n<p>Although PHP 8 will be the minimum,  you can still use PHP string functions, <code>str_contains()<\/code>,&nbsp;<code>str_starts_with()<\/code>&nbsp;and&nbsp;<code>str_ends_with()<\/code> internally in the&nbsp;<code>\\Illuminate\\Support\\Str<\/code>&nbsp;class. You can check <a href=\"https:\/\/github.com\/laravel\/framework\/pull\/38011\">here<\/a> for more detail.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Yuuma<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11462\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/11462\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"Laravel 9\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11462\" data-text=\"Laravel 9\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11462\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11462\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s not officially release yet. It was originally scheduled to be released around September this year,  [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11462"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=11462"}],"version-history":[{"count":2,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11462\/revisions"}],"predecessor-version":[{"id":11465,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11462\/revisions\/11465"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=11462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=11462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=11462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}