Install Laravel
composer create-project
Composer is the package manager for PHP, and Laravel is distributed through it. One command downloads the framework and a starter project into a fresh folder.
Run the command in the folder where your projects live. It takes a minute on the first run while packages download.
Create a new Laravel project
composer create-project laravel/laravel my-app
Creating a "laravel/laravel" project Installing the starter files
When the command finishes, a my-app folder holds the full project: routes, controllers, views, and configuration.
Serve it
Move into the new folder and start the development server with Artisan, the command line tool bundled with every Laravel project.
Start the development server
php artisan serve
INFO Server running on [http://127.0.0.1:8000].
Keep that terminal open while you work. The server reads your code on every request, so there is nothing to restart after edits.
App key note
Every project needs an application key that encrypts sessions and cookies. The installer normally writes it into the .env file in the project root.
Pages that use sessions fail with an app key error when the key is missing, so check that file if you see such a message. Code reads the key through the env helper.
$key = env("APP_KEY"); echo strlen((string) $key);
Open the welcome page
Open the address printed by the serve command in a browser. You should see the default Laravel welcome page with links into the docs.
That page is a view served by the default route. It lives in the routes file and looks like this.
Route::get("/", function () { return view("welcome"); });
Next: Your first route
Article author: Arthur Isaev