I've crafted this for those who have a deep love for PHP. It's not just for the framework users, but also for those curious about the magic behind this popular PHP framework.
This serves as an understanding of how Laravel works, an operational tutorial, and offers unique ways to optimize along the way. You're welcome to delve deeper into Laravel and advance your skills.
So, I'm eager and grateful to share the inner workings of Laravel with you fella!
Big thanks to @taylorotwell for making Laravel framework accessible to all. If you're looking for someone to follow or sponsor, he's a great choice!
"Make developers' lives easier, and you'll be heaven-bound for sure." — Yours Truly
Laravel is a vast PHP framework with a plethora of features and technologies. I warmly welcome all corrections, suggestions, and new ideas to this analysis. Together, let's help fellow web-artisans better understand this framework.
- Installing Laravel
- Altenative ways of installing Laravel
- Setting up the project/Configuring
- Launching Laravel Project
- Laravel Basic Tree
- Diving into Laravel Engineering
- Jump into your interest Laravel part
- LICENSE
First off, according to the official Laravel documentation, you'll need to have PHP and Composer installed on your system to create and use Laravel projects.
To create a new Laravel project, use this command:
composer create-project laravel/laravel:^11.0 laravel-project
Alternatively, you can use the Laravel installer:
composer global require laravel/installer
laravel new laravel-project
If you're wondering what Composer is, it's an application-level dependency manager for PHP. Check out Composer's official website for more info.
For the geeks among us, here's another method:
git clone https://github.com/laravel/laravel.git
cd laravel
composer install
Using this method, you'll need to change the file .env-example to .env, which contains the environment variables for your application.
Notice that the vendor directory is not present initially. After running the composer command, the vendor directory will be created, containing the composer dependencies. We'll explore this further later on.
By default, Laravel uses sqlite database. However, for this analysis, we'll use mysql:
Update the .env file as follows:
Before:
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
After:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
Assuming you have a database called laravel, customize these credentials as needed.
Ensure you've created your database using mariadb or phpmyadmin.
Next, run this command to initialize the pre-defined tables that come with Laravel, such as session storage:
php artisan migrate
php artisan serve
By default, Laravel listens on port 8000. After running this command, open your browser and go to http:localhost:8000 to see the default page.
The tree is quite large, so I've placed it in a separate file. You can view the Laravel Tree here.
Now that you've seen Laravel's default page, let's delve into what's behind the scenes.
We'll start with the artisan file, here.
Feel free to explore my the whole roadmap.