After we learn to create a new project and learn to recognize the existing file structure and its functions in the Laravel Tutorial for Beginners part 1, in this laravel tutorial we will learn to run Laravel in development mode, get to know artisan files and connect them with GIT as source code management.
Best Laravel tutorial for beginners part 2 (mode development,file artisan,GIT)
Table of Contents :
- Php artisan in development Mode
- Link laravel project to GIT
Php artisan in development Mode
When we create a new project in Laravel, Laravel automatically creates a file called artisan which contains PHP code
The Artisan file, that contains the php code – photo by webbaliseo
We can see the features that can be done by artisan files by using the “php artisan” command, Open a terminal in VsCode then type php artisan
Command of the artisan file – photo by webbaliseo
If we see it the above photo, there are lots of commands that we can use to run laravel applications in the development process, to run laravel in development mode we can use the command “php artisan serve“, remember in the development process not in production or deploy mode servers.
to run the command “php artisan serve” we open the terminal then type php artisan serve it will appear like picture 1 below, then we open our browser then we type http://127.0.0.1:8000 kama will open laravel page like picture 2
Running the php artisan serve command in development mode – photo by webbaliseo
If we want to stop the php srtisan serve command, we can press CTRL+C on the terminal.
Link laravel project to GIT
After we have successfully run Laravel, then we will connect our Laravel project to GIT as the source code management, we can see that there is a .gitignore file that is automatically created by the Laravel project whose function is to tell which parts do not need to be committed to the Git repository .
Open terminal in your project then type git init then type git status type git add . after that we check the status again with the git status command then we commit our project with the command git commit -m ‘setup laravel project’ if you get a note: “please tell me who you are” you can do the command git config — global user.email “your email name” and git config — global user.name “your name” as shown below
connecting laravel project to GIT – photo by webbaliseo
why do we commit our laravel project to git ? because laravel is well integrated with GIT so we will easily manage our project later.
That’s the Laravel tutorial for beginner part 2, see you in Laravel tutorial part 3.
You may want to take a look at other laravel tutorials :