Laravel 10 full course for beginner - understand composer json

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
now before moving into level 10 and understanding some of the important file and directories it is very important to create the git repository for this course so I am first going to do git init so by doing the git in it it initializes git in our application by doing that you can see a lot of things are become green this shows that it is now gate is tracking all the file now I need to say hey git add everything so when I say add all it will move everything into the staging once we are done with this then I say git commit with a message and call the messages let's begin so let's do this and you can see now directory is clean everything is now on git but we need to move this into the GitHub and for that I'm going to create a new repository under bit fumes and I call it laravel 10 for beginners okay so I call it level 10 goals for beginners it's a public repository obviously and let's create now once you create it then GitHub says that hey have you done all these things if not you can use all these commands otherwise if you have already existing git repository you can run these three which is just going to push your code into this repository so since we have already done the git add git commit we just need to run these three command which is like git remote add origin so it will just going to Define the remote repository then it will create a branch called main which we already have done and then it will push so let's hit enter and now let's see what's going to happen so very soon all these things will be available on our repository so once this is finished go to github.com reload this page and you can see all of the code which we are working is here now first thing is you can see there is a readme file so to understand the file and directory structure let's start with the readme so readme file is just a file which is going to Define about the project so I will say level 10 course and get this course from bit fumes YouTube Channel now once I done with that what I will going to do I'm going to open the new terminal once again if you don't know what is a shortcut you can click here and see this is the shortcut in my case you can check for your shortcut to open a new terminal so once you have done with this then you can see git status is this it says that readme file is now modified so I will say git add all since I need to Stage all the files and then I said get commit instead of let's begin I say updated the readme file once I am I have committed everything then I just need to say get push so git push and wait for a minute or for some few seconds and you can see everything is now synced so now if I reload you can see GitHub is now having the latest version of readme file okay so this is done and you can see the readme file is changed with this commit and it says now cool so whenever you need any help from the code you can just visit this github.com bitfume level 10 for beginners and you will going to get all the source code from this course now let's press command k to just clean this terminal and open the Explorer here you have seen the readme now what about this fight dot config so this is a front-end thing I don't think I need to explain it much this is the real important thing PHP unit dot XML so whenever you write the test in level you write test in PHP unit PHP unit is a framework for PHP test and for that this is the configuration file for the PHP unit so this is only useful when you're writing test now all you already know package.json this is for npm dependencies similar to this we have a composer.json and in this composer.json we are defining what are the packages we need now this is extremely extremely important why because we have two different kind of require requiring the packages now first it says it needs the PHP which is 8.1 then it says it need a guzzle then it says it need a laravel framework oh wait what's that mean I said I am having a larval framework or larval project but then it says that level itself need a laravel framework package what's going on here okay let me explain what actually happening so if you go on laravel website or documentation if you scroll down you will see this GitHub link so click there and if you open this one if you scroll down you can see there are two public thing one is larval larval uh project and then this is a package so this is the project which we require remember composer create project level slash level this is the real thing which we have used but this level project need a framework package to level framework is a package where we have all the level related things or you can say laravel configuration so this is the package which is required by level project so that's why here it is then there is a sanctum there is a Tinker all these are required some are required Dev now what is mean by required Dev so see when we are creating project we create on our local on our system but when we push our project to server then we don't need the packages or some helper functions which are helpful in writing the code or in creating the project so just like Faker just like paint sale mockery Collision PHP unit level ignition all these package are only available or should only be available on our local so when you run the project on the server you only require these things not these packages but then you will say sarthak hey where is these packages so whenever you have composer and you say composer install and you hit enter then it will read all this composer dot package file then it create a composer lock file which is locking the version so that if you share your project with another people it will not download any other version so basically when you say composer install it will read all these things and then it will install everything in your project inside this vendor file so we just saw that level need a level framework package is it available here let's see so we should have laravel yes and yeah we have the package called level framework cool and remember we also has the paint we also has the sale sanctum and Tinker but along with these packages which are which are available on our composer Json composer Json only have one two three four five six seven eight nine ten eleven twelve packages but here we can see list of all the packages because every package require other packages so all the dependencies packages are also here think about vendor folder as the node module folder in your node application so vendor need everything but what if I delete this directory so I have deleted it how I can get back everything remember just like npm install we have composer install so I say composer install and when I do that you can see it's installing each and every package and their dependency packages in our application and soon we have this vendor directory filled with all the packages or dependencies this project needed so this is how this composer dot Json file is extremely extremely important now there are some more things like auto loading auto loading Dev similar to choir and required auto loading will be available everywhere but Auto load Dev only available on the local or on the testing then some of the scripts you run whenever you create whenever you run composer script then these runs and some of other things which are not that important for now okay so this is composer Artisan we already know git ignore as the file or the directory which we want to ignore we don't want to push to our GitHub repository this one then we say that it is git ignored so we never push dot EnV we never push the content of storage we never push the vendor so where is the vendor yeah here is the vendor so like that there are a lot of files and folder okay so now we have this dot EnV file it is extremely important file because it hold all the important configuration secret Keys name username all of these things so this is a centralized place for everything suppose you need to connect to your database how you connect you define the database name username password but instead of writing all these things in a file where you have to change for every environment you put everything inside the dot Envy so that when you go on the production you put the production related things on a centralized place called dot Envy file or the environment file okay so that's the file structure and now let's start to understand the level 10 more
Info
Channel: Bitfumes
Views: 32,916
Rating: undefined out of 5
Keywords: Laravel 10 for beginners, Learn Laravel 10 from scratch, Laravel 10 course for beginners, PHP framework tutorial, Laravel MVC tutorial, Blade templates tutorial, Laravel routing tutorial, Eloquent ORM tutorial, Laravel database tutorial, Laravel forms tutorial, Laravel authentication tutorial, Laravel authorization tutorial, Laravel validation tutorial, Laravel CRUD tutorial, Laravel REST API tutorial, RESTful API tutorial, API development tutorial, laravel routes
Id: CUbvMoOvrYY
Channel Id: undefined
Length: 12min 12sec (732 seconds)
Published: Tue Mar 07 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.