Getting Started :-
==================
1. Prerequisite to learn laravel :-
------------------------------------
1. Prerequisite :-
--> To learn laravel, the user must be familiar with the following topics :-
a. PHP with OOPS Concepts
b. MVC Structure
c. MySQL
2. System Requirement :-
--> Before starting the laravel installation, users should be aware of the
following minimum system requirements :
a. PHP
b. MySQL
c. Composer
d. IDE (Integrated Development Envirnment)
e. Database GUI Tool.
===================================================================================
===================
2. Composer :-
---------------
1. What is Composer ?
--> Composer, is a cross-platform dependancy manager for PHP.
--> It allows you to declare the libraries your project depends
on and it will manage (install/update) them for you.
a. Here, All pacage install inside the "Vendor/" directory.
b. Update :- Composer update
Install :- Composer install package_name
--> Composer allows developers to specify project dependencies in a
"composer.json" file and then composer automatically handles the rest.
--> Download Composer :
a. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
b. php -r "if (hash_file('sha384', 'composer-setup.php') ===
'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cd
a447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt';
unlink('composer-setup.php'); } echo PHP_EOL;"
c. php composer-setup.php
d. php -r "unlink('composer-setup.php');"
Example :-
composer require spatie/laravel-pdf
composer require laravel/ui^2.1
===================================================================================
===================
3. Installation of Laravel :-
------------------------------
1. There are two ways to install laravel :-
a. Using Laravel Installer
1. Install Laravel :-
composer global require laravel/installer
2. Add composer to path to access laravel globally :-
export PATH="~/.config/composer/vendor/bin:$PATH"
3. Create a new Laravel application
laravel new example-app
4. Install missing packages and their dependencies :-
cd example-app
composer install
5. Run the projects :-
a. php artisan serve
b. localhost/project_name/public/ (2nd Method)
b. Using Composer
composer create-project laravel/laravel example-app
===================================================================================
===================
4. Folder and File structure of Laravel :-
-------------------------------------------
1. app
a. console
Kernel.php --> Create a Custom Commands.
b. Exceptions
Handler.php
c. Http
Controllers
Middleware
Kernel.php -->Register the Middleware.
d. Models --> Database Communication
e. Providers
2. Bootstap
3. Config
4. database
a. Factory --> Create a fake data
b. Migration --> Create a table for database.
c. Seeders --> Insert the data inside the table.
5. Public
a. .htaccess --> Server Configration
b. index.php
c. robots.txt
6. resources
a. css
b. js
c. lang
d. views
7. routes
a. api.php
b. channels.php
c. console.php
d. web.php
8. storage
a. app --> all pdf,excel file when we created inside here
b. framework
c. logs
9. tests
10. Vendor --> All dependencies folder/file heres
11. .env
===================================================================================
===================
5. Sample Laravel Application :-
--------------------------------
a. Define a View File Location :-
Location :- resources/views/<html_file>
b. Define a Route for View Location :-
Location :- routes/web.php
Route::get('/', function () {
return view('welcome');
});
c. Change the view path loaction from config folder :-
Location :- config/view.php