⚡What's new in Laravel 11 | Laravel 11 New Features | Laravel 11 install | Laravel 11 Release

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello guys welcome to my YouTube channel if you are new to my Channel please subscribe to my channel like this video and press the Bell icon laravel 11 is set to be released next week in this video you will learn how to install laravel 11 development version and see what's new inside it we will compare it with laravel 10 before we get started make sure not to use it in production until the final version is released laravel 11 requires a minimum of PHP 8.2 so make sure you have PHP 8.2 installed on your system right click and select open in terminal now type the command PHP - V to check the PHP version installed on your system you can see that PHP 8.2.0 is installed on my system which meets the minimum requirement for laravel 11 I have started Apache and my SQL in zamp server I will use the laravel installer to install laravel 11 for this tutorial however you can also install laravel 11 without the laravel installer in your terminal type the command laravel new your project name d-d and press enter if you want to install it without using laravel installer then type the command composer create Das project-- prefer DD ll/ laravel your project name dev-master now you will be asked if you want to install a starter kit like breeze and Jetstream type none and press enter now you will be asked for testing framework type zero for pest or type one for PHP unit and press enter now you will be asked for a get repository type no and press enter it will take some time to download depending on your internet connection so wait for the download to get completed now you will be asked to select database type MySQL and press enter now you will be asked to run default database migrations type no and press enter laravel 11 has been downloaded successfully type the command CD your project name to go to the project directory now open your project in vs code we need to create a data database for our project open. EnV file copy the database name now go to your browser and open PHP my admin click on new to create a database paste the database name and click on create the database has been created now we will migrate the database open a new terminal type the command PHP Artisan migrate to migrate the database you will see an error general error 1273 unknown colation utfm 4ore 0900 _ aore C this error typically occurs when attempting to import a database dump or run a SQL script that contains collations not supported by the current MySQL version to fix this open database.php file which is inside the config folder here you will find the cation section in the MySQL configuration replace this value with utf8 mb4 Unicode CCI now type the command PHP Artisan migrate colon fresh to migrate the database you can see that the migration was successful and the tables have been created open PHP my admin and click on the database you will see that all the tables have been created open your terminal and type the command PHP Artisan serve to run our laravel 11 app open your browser and type Local Host colon 8000 you will see a new welcome page scroll down and you will see laravel version 11x DAV and PHP version 8.2.0 I have installed laravel 10 and migrated the database now let's run the app in your terminal type the command PHP Artisan serve d-port equals 801 to run laravel 10 on Port 801 as laravel 11 is running on Port 8000 open your browser and in a new tab type Local Host colon 801 and you will see the welcome page of laravel 10 in the bottom you will see the laravel version which is 10.47 point0 to compare laravel 11 with laravel 10 I have opened both projects Side by Side open app folder in both the projects in laravel 11 there are only three folders HTTP models and providers whereas in laravel 10 you will see five folders console exceptions HTTP models and providers open h TTP folder in both the projects in laravel 10 you will see both the controllers and middlewares folders along with the kernel.php file whereas in the laravel 11 project you will only see the controllers folder open controller.php you can see that in laravel 11 it is an abstract class whereas in laravel 10 controller is a class here the controller class extends the base controller and uses the authorizes requests and validates requests traits there is another folder in laravel 10 middleware which includes nine middlewares the middleware folder is missing in laravel 11 in laravel 10 you will see a kernel.php file which is also missing in laravel 11 now open the model folder in both laravel 11 and laravel 10 and you will see the user model which is the same in both now open providers folder you can see that in laravel 10 there are five provider files app service provider off service provider broadcast service provider event service provider and root service provider in laravel 11 there is only one provider file which is app service provider now open bootstrap folder in laravel 10 there is a cache folder and app PHP file whereas in laravel 11 you will see cache folder app.php and providers. PHP file in laravel 11 from the app.php file you can now customize your applications routing middleware service providers exception handling and more now open providers. PHP file in laravel 11 this file is used to load the app service provider class located in the app back/ providers name space as a service provider when the application boots up now open config folder in both projects you will notice that in laravel 11 broadcasting. PHP course PHP hashing PHP sanctum PHP and view.php files are missing now open migrations folder in laravel 11 there are three migration files whereas in laravel 10 there are four migration files in laravel 11 you will see there are three default tables users password reset tokens and sessions in laravel 10 there is only one default table users in the first migration file open the second migration file in laravel 11 and will see the cash and cashore locks tables which are new additions in laravel 11 in laravel 10 there is only one table password reset tokens in the second migration file in third migration file you will see three tables jobs job batches and failed jobs in laravel 11 whereas in laravel 10 there is only one take table failed jobs in third migration file now open fourth migration file in laravel 10 and you will see only one table personal access token in Roots folder there are four files API channels console and web.php in laravel 10 whereas in laravel 11 API and channels. PHP files are missing if you open EnV file in laravel 11 you will see a new addition app times Zone equals UTC scroll down and you will see the app loal section followed by app maintenance driver equals file and app maintenance store equals database which are new in laravel 11 you can also notice bcrypt round equals 12 which is one more addition in laravel 11 then you will see session section where session driver equals database which means that session data will be stored in the database in laravel 10 session driver equals file which means that session data will be stored on the the server's file system then you will see cashore store equals database which means that cache items will be stored in the database it is also new in laravel 11 we have seen that api.php and channels. PHP files are missing from the web Roots now to get back both the files there are new commands let's see those commands in your terminal type the command PHP artisan and press enter you can see two new commands install colon API and install colon broadcasting in your terminal type the command PHP Artisan install colon API before running this command open app PHP file which is in the bootstrap folder now press enter to run the command this command will install larav El sanctum and then automatically add API roots in the with routing section of app.php it will also generate api.php file in The Roots folder you may have noticed that API Roots have been automatically added in the app PHP file it will ask for database migration for API type yes and press enter open Roots folder and you will see api.php file has been added now let's create a Broadcasting channel Roots file in your terminal type the command PHP Artisan install colon broadcasting and press enter type no and press enter because as of now laravel Reverb has not been released you can see that channels. phpr Roots file has been added in The Roots folder if you open app.php file you will see a new health check route that can be used to monitor the status of your application in your browser type Local Host col 8000 slup and you will see the status page showing that your application is working in production this route may be used to report the status of your application to an uptime monitor load balancer or orchestration system such as kubernetes open welcome. blade. PHP file in the footer section add a link to open the health rout reload the page and you will see a link to open the health route click on the link and you will see the status of your application open app.php file replace up with status and it will work the same as before open welcome. blade. PHP file and replace up with status now open your browser and reload the page click on the link and you will see the status of your application let's create a middleware in your terminal type the command PHP artisan make colon middleware ensure user is subscribed and press enter the middleware is created open insure user is subscribed middleware file in the handle method add the DD helper function which will display the message ensure user is subscribed middleware and stop the execution of the script now open app.php file here we need to add the middleware in the with middleware function type dollar middleware followed by an arrow then a pen function inside the parentheses add insure user subscribed class and import the insure user subscribed middleware this middleware will be applied to all the roots open your browser and reload the page you will see the message ensure user is subscribed middleware now what if you want to add the middleware only to a specific route comment out this code open web.php file add middleware function in parenthesis add Ure user a subscribed class and import it [Music] open your browser and reload the page and you will see the same output as before now let's assign an alias to the middleware remove the middleware which we have added open app.php file add dollar middleware followed by an arrow then add the Alias function within the parentheses of the Alias function add an array inside this array specify the Alias name such as is do subscribed and assign it the middleware class using the insure user is subscribed colon colon class syntax copy this Alias name open web.php file now add the Alias name is do subscribed with the middleware function to the root open your browser and reload the page and you will see the ensure user is subscribed middleware message let's create a dashboard view file in the views folder add subscribers only text in the H3 tag open web.php file and add a route to display the dashboard view remove middleware from both Roots open your browser and reload the page and you will see the welcome page P now if you navigate to the dashboard route you will see the dashboard page now add these do subscribed middleware to the dashboard route open your browser and reload the page and you will see the ensure user is subscribed middleware message now if you navigate to the Home Route you will see the homepage indicating that the middleware is only applied to the dashboard route let's create a service provider in your terminal type the command PHP artisan make colon provider payment Gateway service provider and press enter this command will create a payment Gateway service provider in the provider's folder open payment Gateway service provider. PHP file in the boot method add DD helper function which will display the message payment Gateway you don't need to register this provider as it is autodetected in laravel 11 now open your browser and reload the page and you will see payment Gateway message from payment Gateway service provider comment out the DD function open your browser and reload the page and you will see the welcome page now let's create an event type the command PHP Artis make colon event and press enter now you will be asked for the event name type post created and press enter now we need to create a listener for our event type the command PHP artisan make colon listener and press enter now you will be asked for the listener name type send post created notification and press enter now you will be asked what event should be listened for type post created and press enter open send postc created notification. PHP file in the handle method add DD helper function which will display the message post created now open web.php file and dispatch the postc created event in the Home Route and import the post created class by default laravel will automatically find and register your event listeners by scanning your applications listeners directory open your browser and reload the page and you will see post created message we have covered some of the most important features in laravel 11 but there's still a lot more to explore at Lon EU Taylor otwell announced that her for Windows a laravel and PHP development environment will soon be available additionally laravel Reverb a first-party websocket server for real-time Communication in laravel applications is also on the horizon according to the laravel website laravel 11 is scheduled to be released on March 12th 2024 once the final version is released we'll dive deep into the framework to uncover even more of its capabilities thanks for watching please like share and subscribe to my channel I will see you in next tutorial till then stay safe
Info
Channel: Php Node Tuts
Views: 3,565
Rating: undefined out of 5
Keywords: laravel 11, laravel 11 new features, laravel 11 tutorial, laravel 11 release date, laravel 11 features, laravel 11 skeleton, laravel 11 changes, laravel 11 install, laravel 11 обзор, laravel 11 что нового, laravel 11 middleware, laravel 11 github, laravel 11 release, laravel 11 course
Id: z7a8rlEoKoo
Channel Id: undefined
Length: 23min 8sec (1388 seconds)
Published: Sun Mar 10 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.