Laravel Quickstart

Installation

This is a quick start guide to setup a laravel project with local composer installation. Beware that the widely accepted practice is to install composer at system level. This guide installs composer at local level

This guide also assumes you have installed and configured PHP.

Install PHP modules

sudo apt install openssl php-common php-curl php-json php-bcmath php-mbstring php-mysql php-xml php-zip openssl php-mbstring

Create a directory

mkdir my-app

Install composer locally

For the official instructions read here

The local installation is quite easy:

cd my-app
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Install required laravel modules.

Currently for Laravel 9 (for more read here):

Create an empty Laravel project

composer create-project laravel/laravel my-app

Composer cannot create a new project in a non empty directory.

If you want, you can move composer to the Laravel directory.