To use composer, you need to connect to the server via SSH or go to Terminal in cPanel. For information on SSH access and using the Terminal, see article.

In this article we will be entering commands in the terminal built into the panel.

By default composer is installed on all shared hosting servers, for example to see the version of composer you can use command.

composer -V

file

Creating a project in Laravel

To create a new project in Laravel, we first create a new project using composer.

Go to the public_html folder
cd ~/public_html/
Create a new project
composer create-project --prefer-dist laravel/laravel laravel-test.com
Replace laravel-test.com from the example with the folder name you need for the new project.

file

Next, add the domain where our project will be located in cPanel, an example of adding a domain can be seen at link. In our case the domain will be called laravel-test.com .

file
Important: for Laravel, when specifying the path to the site root directory at the domain creation stage, you must specify the directory project_folder/public, rather than using the default option - domain_name**

Next, specify the php version for the created domain at least 7.1, this is the minimum requirement for Laravel version 5.7, which we use in this guide.

Let's check the created project in a browser.
file