php-laravel
Install PHP
sudo apt-get update && \
apt-get -y install \
php-cli \
php-curl \
php-mbstring \
php-gd \
php-json \
php-ldap \
php-mime-type \
php-pgsql \
php-tidy \
php-intl \
php-xmlrpc \
php-soap \
php-uploadprogress \
php-zip
Download Composer Latest
Windows Installer
The installer - which requires that you have PHP already installed - will download Composer for you and set up your PATH environment variable so you can simply call composer from any directory.
Download and run Composer-Setup.exe - it will install the latest composer version whenever it is executed.
Command-line installation
To quickly install Composer in the current directory, run the following script in your terminal. To automate the installation, use the guide on installing Composer programmatically.
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');"```
This installer script will simply check some php.ini settings, warn you if they are set incorrectly, and then download the latest composer.phar in the current directory. The 4 lines above will, in order:
- Download the installer to the current directory
- Verify the installer SHA-384, which you can also cross-check here
- Run the installer
- Remove the installer
Most likely, you want to put the composer.phar into a directory on your PATH, so you can simply call composer from any directory (Global install), using for example:
sudo mv composer.phar /usr/local/bin/composer
Your First 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 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