Step By Step To Setup A Laravel Project
Before creating your first Laravel project, you should ensure that your local machine has PHP and Composer installed. If you are developing on macOS, PHP and Composer can be installed via Homebrew. In addition, we recommend installing Node and NPM.
After you have installed PHP and Composer, you may create a new Laravel project via the Composer create-project
command:
composer create-project laravel/laravel example-app
Or, you may create new Laravel projects by globally installing the Laravel installer via Composer:
composer global require laravel/installer
composer global config bin-dir --absolute # It will return the path to the directory
export PATH="$PATH:/path/to/composer/bin" # Replace /path/to/composer/bin with the path obtained in the previous step
source ~/.zshrc # or source ~/.bashrc
After installing the Laravel installer, you may create a new Laravel project using the laravel new
command:
laravel new example-app
After the project has been created, start Laravel’s local development server using the Laravel’s Artisan CLI serve
command:
cd example-app
php artisan serve
Once you have started the Artisan development server, your application will be accessible in your web browser at http://localhost:8000
. Next, you’re ready to start taking your next steps into the Laravel ecosystem. Of course, you may also want to configure a database.