Installing Laravel (The Right Way)
Wait... What is Composer?
Composer is a dependency manager for PHP. Think of it like npm (for Node.js) or pip (for Python).
It handles all the PHP packages your app depends on — including Laravel itself. You don’t want to manually download and update every library, right? Composer handles that headache for you.
Why use Composer?
- It automatically downloads libraries and dependencies.
- Keeps all your packages organized in a
composer.json
file. - One command to install or update everything. Magic! 🧙♂️
- Laravel and most modern PHP frameworks require it.
Step 1: Install Composer
👉 Download Composer from the official site: getcomposer.org/download
For Windows:
- Download the Composer-Setup.exe
- Run it, and let it install globally
- Open command prompt and type:
composer -V
— You should see the version!
For macOS/Linux:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php sudo mv composer.phar /usr/local/bin/composer composer -V
Step 2: Install Laravel
You can install Laravel globally or use the Laravel installer, but the most common and cleanest method is using Composer.
composer create-project laravel/laravel myApp
⬆️ This command will:
- Create a new folder
myApp
- Download all the Laravel files
- Set up a full Laravel project ready to go 🚀
Start the Laravel server:
cd myApp php artisan serve
Open your browser and go to: http://localhost:8000
Now you’ve got Laravel running locally. Time to build something awesome!
0 Comments