Laravel 11: New Slimmer Application Skeleton | williamsk

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] so in this one we're going to take a look at what's coming up on the horizon for Lal so this is an amazing platform that you can use to develop almost anything so what is coming up as far as what's new in larval and version 11 so we're going to take a look at that right now let's just jump to the documentation we're going to scroll down just a little bit and we're going to take a look at supportive policy and right now we can see that there's a new version of laral coming up and it looks like it's version 11 and and what's interesting to note is coming out in the first quarter of 2024 and just looking at like previous releases we can see that maybe it'll be some time in February as what will be the first quarter there's a rumor mill that I think it's February 6th that's going to be the date but we know it's going to come out sometime in the first quarter so hopefully February based on these patterns so looks like version 8.1 works for all previous versions of flal but in version 11 you're going to need a minimum requirement of PHP 8.2 so you can check out the latest version of PHP by going to php.net and you can also see what versions of PHP are being used and which ones are going to be at their end of life so usually PHP has about 3 years before they turn their version over to what's called end of life so in 2021 version 8.1 came out and during that time 2 years worth of support and on the third year usually it reaches end of life so we can say that PHP uh 8. 2 came out around 2022 and we're looking at 2025 before it reaches its end of life which kind of makes sense is why Taral is starting to use version 8.2 because towards the end of 2025 that's when they'll be supporting bug fixes until this date it looks like and security fixes until this date so they're just trying to coincide with what and how PHP is being developed all right let's jump into the terminal and take a look at some stuff so now inside my terminal I'm inside my projects directory and within that I'm just going to check the version version of PHP in my case I'm using version 8.3.1 and you can update your version of PHP we do so on the channel using Homebrew and I'm going to show you guys another method later on in the channel how to do that as well there are videos on this in the channel that you can follow and get your version of PHP up to date so just keep in mind that the minimum version required for larl 11 is 8.2 so if you want to early access to the dev copy you can say larl new and you can create a new project and in this case I created a project called larva 11 and use the-- flag so I've already done that so I'm not going to run this application and I also created another one called L10 so this is just to compare the two Frameworks L L10 and Lara 11 so with that said I'm just going to CD into my larva 11 directory so now I'm going to jump into the browser to show you both versions of the project so over here I have a version of laral 11 and as you can see it's the 11x dodev and we're running a version of PHP 8.3 and over here in this browser we now have the current version of laral which is laral 104.1 as of this recording and and it's running also 8.31 so you don't need 8.31 to run larl 10 but in this case since I'm on PHP version 8.3 we're running the same versions of PHP okay let's take a look at both of these projects inside of an IDE all right so here we are in both projects so I have a version of laral 10 open over here on the right and on the left I have a version of laral 11 the development uh Branch so at first glance it doesn't look like there's a lot that has changed but larva 11 is geared towards being a Slimmer application skeleton as that compared to larel 10 so let's take a look at some of the obvious things so we'll start at the app so I'm going to the app folder inside of Lal 11 and the app folder inside of LL 10 so when we open up the app folder inside of LL 10 we can see that we have a console folder we have exceptions we have the HTTP folder we have models and we have providers in LVL 11 two of those folders are missing so we're missing console and we're missing exceptions so let's take a look inside the HTTP folder inside laral 10 and then we'll also open up the folder over here on the left so we're also missing the middleware folder in laral 11 and you also notice that we're missing the kernel.php file which was present in LEL 10 and is no longer in this directory in LEL 11 so let's just open the controllers and if you have a key ey you'll notice that the actual controller.php file is a class and in this version of laral laral 11 the actual controller.php file is actually an abstract class and you notice in this abstract class it contains at least one abstract method it's declared but it's not implemented in code and over here we have a class that is being extended by a base controller and over here we have these traits that are being used by this class so that's a pretty noticeable difference inside of how the controllers are going to work versus larel 10 and larel 11 okay in the models directory we still have a user.php file so the user's model is being created here in larel 10 and also in larval 11 over on the left under the providers there is one single file app service provider and in laral 10 there are literally five service provider files okay let's take a closer look at these files and as you can see for the most part I'm not going to go into all the details but they're almost identical so let's close the app folder on both projects and let's take a look at this bootstrap folder which has changed significantly in laral 11 versus larl 10 in laral 10 we only have the single app.php file and in larel 11 we also have a provider file and you can see that inside of this file here larel 11 returns an array of service providers and more than likely this is where you're going to add the rest of your service providers so you'll keep your service providers inside of a single provider class called providers. PHP and within that you'll have the list of different providers that you want to have in your project let's go back to the list of directories so just taking a quick look it looks like the bootstrap folder is going to play a significant role in how the project is scaffolded inside of larval 11 another interesting thing is if we go to the config folder here in Lara 11 all the configurations that we used to have are no longer visible so they're they're gone if we compare that to larl 10 we'll see that all the config files that we normally have in original scaffolds when we first created a larel project are listed here now they're not gone completely from lbr 11 per se they're just not published so let's jump to our terminal and take a look at how you can put that in if you're familiar with laral there's a command called PHP Artis and PHP Artis will list all the available commands that are available within your project things that you can do so I'm using an alias called PA but the full command is PHP Artis it will give you a list of all the commands that are available that you can use with Artis so the one that we're really looking for I'm going scroll to the top is config you would type in PHP Artis config and the one that we're looking for is this one here publish so that's what's missing on L 11 So within that config directory it's empty but we can use PHP Artisan to actually publish the configuration files that we need so let's try that so I'm going to say PA for PHP Artisan use config publish so it's PHP Artisan config publish and what that will do is bring up this interface that we can choose which configuration file we'd like to publish they're all visible here all the way down to views so let's just publish views cuz we're on this right now let's take a look so inside of our larva 11 project you'll see that view.php shows up underneath the config directory cuz we published that using Artis let's take a look at the file and let's take a look at the v file in LEL 10 so what it's saying here is you know your views will be in a folder in the framework under views so all your blade files will end up inside of this views directory inside of your framework inside your project so you can do this for every file that you want to add to the config folder so let's go back to the directories if you go to the EnV file inside of larel 11 and you go to the EnV file inside of larel 10 so you'll notice that if we compare the larel 11v file and the larel 10mv file there's some noticeable differences for instance this one has app time zone this one doesn't you go down the thing you can see that your locals are available here so these are usually some of the settings that are available in the app.php file inside of the config folder so once again you can publish that using PHP Artis and you can control those things there or it looks like you can be able to add them to yourb file for a little more convenience so they are working on slimming down this framework and only publishing the files that are necessary or that you feel necessary for your application so at any given time you can change this to whatever your time zone is and that'll be the equivalent of what's in your app.php file so I'm not going to go through every one of these but note that there are slight differences in the larm 11. file than to that of the laral 10. EMV file so let's go back to the directory structure for this project and this one too and if we take a look at databases we have the user Factory on larl 10 we have the user Factory on larl 11 and what's really neat here is they added another migration or they kind of slim down the migration so if we go to the migrations directory in laral 10 we'll see that we have a migration to create a table for a user password reset tokens fail jobs and password access tokens if we go to migrations inside of LL 11 and this is still the dev so maybe these will change or there'll be additional migrations but for now just comparing the two we note that you can still create a users's table and with specific user data or schema but when we go to this one where it says jobs and we're going to go to the fail jobs directory this one here you have fail jobs and it's just one table for failed jobs but over here you have jobs but then you have another table here called job batches and this might be useful because it seems like they're working on allowing you to easily execute bat jobs but then also performing some action on those bat jobs below that you're going to have your fail job so this is the same table as the previous version of larl 10 but they've added batch jobs sorry job batches and they've added jobs and this also coincide with the other migration and this one's called create cach and if we take a look at create cach you have two new tables here cash and cash locks but what's interesting over here is in these cash tables this makes sense if you're using something like I don't know you have some data that's like CPU intensive um I take a long time to retrieve data so This falls into using a cast driver of some sort so something like you know mcash or reddis or Dynamo DB so over here it looks like they're preparing for that and they have these tables that allow you to cash your application this looks like it's going to be a welcome thing for larel 11 and in larel 10 and we don't have that and you may have to create these tables before for caching but in larel 11 when you run PHP artist migrate you're going to have the ability to have created cash tables created jobs job batches as well as failed jobs now there's a lot of things that have changed in relation to LEL 10 versus LEL 11 but I think the most significant change or the most interesting change for me I found was under the routes directory so if we go to routes and we go to routes and larel 10 project you see that there's an AP api.php route there's channels there's console and there's web so what do you do if you want to have say API routes or Channel routes or something like that and they're not available in Lara 11 out of the box with just a new application that you created well let's check that out in terminal so now that we're back in our terminal let's take a look at the Artisan commands and if you go up to install and I'm just going to scroll up to the top here you'll see there's one called install API create an API routes file and install larval sanctum so right there we can tell that laral sanctum is not installed by default inside of aarva 11 project so they remove sanctum out of the initial new project scaffold but you can add it back so let's just do that so now with that command you just notice that we just installed the API scaffolding so that's been installed so let's just check that out inside of our IDE so now back inside of our IDE we'll notice that we have the API routes have been installed and they're the same as the API routes that have been insted in previous version of laral and the same will probably apply for for channels you would do PHP Artis install and this case it would be broadcast so here we are in LEL 11 and channels route is now added back to the routes directory so I'm not going to go over every single change but there's been a lot of changes and this will kind of help you see what they're trying to do and how they're trying to slim up this application so larel versil 11 you'll see how they removed files and things that are necessarily not needed in the beginning when you create a new project because not everyone's going to reach for those but you can add them in when you need them or depending on what you need for your project you'll be able to add that functionality as you need it so what's become really useful in Lara 11 is the bootstrap folder which is where everything is going to be bootstrapped and set up and the apps directory has changed significantly as well so your larel commands that are normally done in console inside of the kernel file are no longer going to be set there you'll be able to do the commands somewhere else in a larva 11 project and same thing goes for the exceptions and these new things will help stream streamline the uh directory structure there's no more HTTP kernel uh models can cast changes now and there's a few new traits uh one of them being dumpable and a bunch more and the limit or the minimum requirement for this Lara 11 will be 8.2 I hope you guys found that useful and I know there was a lot to compare there this will help you kind of get an idea as to what is coming up in larel version 11 and what has changed or what is going to change in larel 10 thanks for watching and I'll see you in the next one oh
Info
Channel: williamsk
Views: 11,272
Rating: undefined out of 5
Keywords: how to, coding, williamsk, laravel 10, laravel 10 tutorial, laravel 10 project, laravel, laravel api, laravel routes, laravel 11, laravel 11 tutorial, laravel versions, laravel app, laravel application, laravel config, laravel database, laravel bootstrap, laravel request, laravel sanctum, laravel project, laravel tutorial, laravel framework, php, php laravel, Laravel 11: New Slimmer Application Skeleton | williamsk, web development, programming, laravel php, learn laravel, mvc
Id: OvIui9M2mts
Channel Id: undefined
Length: 13min 31sec (811 seconds)
Published: Tue Jan 23 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.