The Laravel framework can be installed through a utility called Composer via Secure Shell. In order to use Composer, you need to have SSH enabled on your account because it’s a command line tool only. With this tutorial, we want to provide you with useful information about how to install Laravel through Composer.
Composer comes in a phar file which is short for PHP archive.
You have to have the PHP Phar extension running so you can extract it and use it on your account.
Laravel itself also requires a PHP version of 5.4+ and the Mcrypt extension activated.
With WebHostFace, you can activate those from the cPanel of your account > Software > Select PHP Version.
This tool will give you the chance to select different PHP versions and enable/disable certain extensions.
Now that you have enabled the required extensions, you will need to connect via SSH to your account. We have a detailed tutorial on how you can do that.
Once you are connected to the console, type in the following command to install Composer.
curl -sS https://getcomposer.org/installer | php
After that, you can proceed with installing Laravel through the tool. To install the current latest version of Laravel, enter the following command:
composer create-project --prefer-dist laravel/laravel {directory}
Where {directory} needs to be substituted with the name of the folder in which you wish to install the application. If you want to install it on your primary domain, enter
public_html
If you want to install Laravel on a subdomain, enter the root directory of the subdomain:
sudomain.domain.com
If you want to install an older version of Laravel, for example, Laravel 4.2, you need to enter the following command
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
It will take a few minutes for the installation to complete.
After it’s finished, you may notice a file called composer.json. This is a file in which Composer describes the dependencies (the external packages besides Laravel that are required for the framework to work). Those are downloaded to the vendor folder.
By default, Laravel installs several system files and folders. To redirect your domain or subdomain to the Laravel public folder, follow these steps.
That is it! Now you have a fully functional Laravel installation.