To create a Laravel project you need PHP and Composer (PHP's package manager) installed on your computer.
Requirements
- PHP 8.2 or newer (check the Laravel docs for the exact version your release needs)
- Composer — download from getcomposer.org
- A database such as MySQL or SQLite (new projects use SQLite by default)
Two ways to create a project
composer create-project laravel/laravel blog- Or install the Laravel installer once:
composer global require laravel/installer, thenlaravel new blog
Run it
Go into the folder and start the development server with php artisan serve. Open http://127.0.0.1:8000 — you will see the Laravel welcome page.
The .env file
Settings that change between your computer and the live server — app name, debug mode, database name and password — live in .env. Never upload .env to GitHub.
Example
Example — Create and run a new project
Bash
# 1. Create the project
composer create-project laravel/laravel blog
# 2. Go into the folder
cd blog
# 3. Start the development server
php artisan serve
# INFO Server running on [http://127.0.0.1:8000].
After php artisan serve, open http://127.0.0.1:8000 in your browser to see the Laravel welcome page. Press Ctrl+C to stop the server.