Comment installer une application web Laravel que vous avez cloné depuis Git

Comment installer une application web Laravel que vous avez cloné depuis Git

par Sidick Allaladé le 11/03/2020

Mis à jour le 25/06/2022

Laravel is a powerful php framework and as its slogan says it is 'The PHP Framework for Web Artisans'.

At our web agency we often receive questions about Laravel web development.

If you forgot the steps or commands during the installation of Laravel projects, this tutorial is for you. 

Here is a guide to install Laravel project on a Linux or Windows server or environment from git. 

Table of Contents

1- Login with the right permissions (optional)

If you are logged in as root or superadmin on your server, make sure you change your user to the default web user for the Laravel project. 

Simply do this:

  • Su yourusername

2- Clone your repo

Whether your project is hosted on Github, Gitlab, Bitbucket or other, it all comes back to GIT, so we can use git on our local machine or server to clone our project.

  • git clone name

Note that you clone projects in 2 ways, one in HTTPS mode and one in SSH mode.

PRO TIP: You can clone your project from a specific branch by doing 

git clone -b nameofthebranch

3- Access your project directory

After your clone, a new folder with the name of your Laravel project should be created in your current location.

You just need to access it by making:

  • cd projectname

4- Install the project dependencies from composer

Each time you clone a new Laravel project, you have to install all the dependencies of the project. This is what allows installing Laravel itself, among other packages needed to start the application.

When we run composer, it checks the composer.json file that is in your repo and lists all the composer packages your repo needs. As these packages are constantly changing, the source code is usually not submitted to git, thanks to the .gitignore that should always contain the vendor directory.

So to install all the necessary source code, we run composer with the following command.

  • composer install

You can also think about how to simplify and automate your workflow.

Oshara CEO Sidick

Découvrez comment mon équipe va "transformer" vos affaires grâce à une application ou une technologie fiable

Développement web - Nous sommes une équipe de codeurs web passionnés qui matérialiseront vos idées mieux que vous ne pourriez l'imaginer.

Intégration API - Il n'y a pas de secret en utilisant n'importe quelle API, connectez tous les outils dont vous avez besoin, de la manière dont vous en avez besoin.

Audit informatique et de cybersécurité - Protégez vos clients, protégez votre entreprise et protégez-vous.

Maintenance et support - nous aidons les organisations à accroître leur efficacité, à améliorer leurs performances, à minimiser les temps d'arrêt et à faciliter leur longévité.

Réserver un appel

5- Install NPM dependencies (optional)

This is exactly like the previous step with the only difference that it will allow you to install Vue.js, Bootstrap.css, Lodash and Laravel Mix etc...

In short, instead of installing PHP code as in previous step, it's a matter of installing the required Javascript (or Node) packages.

The list of packages needed in this case are listed in 'packages.json' file.

If your project doesn't use vue.js, node or other you can skip this step, otherwise you have to do : 

  • npm install

Others prefer Yarn, if that's the case, just do it. 

  • Yarn

6- Create a copy of your .env file

The .env files are generally not submitted to your repo, if this is not the case I invite you to correct this for security reasons.

But there is an example .env file, which is a template of the .env that every Laravel project needs to start. 

So we will make a copy of the .env.example file and create an .env file that we can fill in with our configuration settings.

  • cp .env.example .env

7- Generate your encryption key

Laravel requires that you have an encryption key for each application, this is usually randomly generated and stored in your .env. The application will use this encryption key to encrypt various elements of your application, such as cookies, password hashes and many other elements.

Fortunately Laravel's command line tools allows you to generate this key very easily. In the terminal, we can execute this command to generate this key. 

  • php artisan key:generate

Close and open your .env file again, you should notice that the key was generated in the variable: APP_KEY

8- Some practical commands (Optional)

If your Laravel project does not contain a database at this level it should already be working.

If this is the case - Perfect: everything works like clockwork. 

Yeah, everything works alright!

Otherwise try these commands that can help:

Set the right permissions on all directories and files in your project by simply running 

  • chmod 755 -R nameofyourproject/
  • chmod -R o+w nameofyourproject/storage

Clean up your project

  • php artisan cache:clear
  • php artisan view:clear
  • php artisan config:clear

Sometimes you have to add to your /public/ or /index.php/ url

This isn't over, what if you have a database? 

Well, let's get on with it. 

9- Create an empty database for your project

Create an empty database for your project using any database tools you prefer (My favorite is Datagrip for Mac, but sometimes I use DBForge, or Mysql Workbench or even good old Phpmyadmin).

Don't forget to back up the whole thing, you can do that with simple shell script.

10- Configure your .env file to allow a connection to the database

We will want to allow Laravel to connect to the database you just created in previous step. To do this we need to add the connection references in the .env file and Laravel will take care of the connection from there.

In the .env file, fill in the options DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME and DB_PASSWORD so that they match the credentials of the database you have just created.

11- Add the tables and contents of your database with migrations or in SQL

Migrations in Laravel allow you to have all your DB architecture in your code and with a simple command line you recreate all your tables.

  • php artisan migrate

This command creates the structure of your database but does not fill any tables.

If the repository has a seed file, this is the time to run it, in order to fill your database with startup or dummy data.

  • php artisan db:seed

PRO TIP: You can combine the 2 previous commands into one command which is this one: 

  • php artisan migrate:fresh --seed

Migrations are super handy, but if you don't have one you simply import the sql file from your old database with your favorite database tools. This will create all your tables with your contents.


That's all you need to start a Laravel project. Of course, some projects have specific steps that apply only to that project, but the steps I've described above are the necessary steps you'll need to follow to start any standard Laravel project from a git clone.

It's essentially the same thing on Windows, unless you don't have a batch terminal. This would be surprising because if you install git on a Windows server or machine, then right-click in your folder, you should get the 'git bash here' option and you're done.

We at Oshara have been doing web development with Laravel from the beginning. Laravel was just few months old (circa 2011) when we started making custom apps and websites with it. It's a great tool and it simplifies things a lot.

Installing Laravel was not that hard, right?

So installing Laravel was not that hard, right?

I hope this has helped you get started on your next Laravel project. Don't forget to subscribe to our newsletter and follow us on social networks for more great tutorials on popular web technologies and marketing techniques.

If you have any problems with Laravel please contact me or our team at Oshara. We run the best custom web development agency in Montreal.

Questions fréquemment posées

C’est un Framework php puissant et comme son slogan le mentionne, c'est vraiment le Framework PHP pour les artisans du web - 'The PHP Framework for Web Artisans'.

Il vous permet de créer des solutions web personnalisés sans limites en fonction de vos besoins, vous pourriez par exemple créer un réseau social tel que Facebook avec Laravel.

Clonez votre repo, accédez au répertoire de votre projet web, installer les dépendances de l'application web à partir de composer, créez une copie de votre fichier .env, générez votre clé d’encryption, créez une base de données vide pour votre projet Laravel, configurez votre fichier .env pour permettre une connexion à la base de donnée et ajouter les tables et contenus de votre base de données avec les migrations ou en sql.

Sidick Allaladé

Sidick Allalade, est directeur technologique à Oshara INC, et Co-fondateur de l'application web Osortoo. Il adore résoudre les problèmes informatiques complexes, doué dans le code et l'univers informatique, il a une bonne connaissance du marketing en ligne et en Gouvernance, Audit et sécurité des TI. 

Ses expériences sur des centaines de projets avec des compagnies de différentes envergures font de lui un atout précieux dans le web.

Cet article a-t-il été utile ?

Les lecteurs de cet article lisent aussi ...

Pourquoi suivre un processus de conception pour vos logiciels ou applications web ?

Un sage a dit un jour que si on ne planifie pas, on planifie alors d'échouer. Souhaitez-vous réduire le temps de développement de vo...

Pourquoi suivre un processus d...

Comment installer une application web Laravel que vous avez cloné depuis Git

Laravel est un Framework php puissant qui vous permet de créer des applications web sur mesures

Comment installer une applicat...

Développer une application Native, Hybride ou Web ? Quelles sont les différences ?

Il existe différents types d'application (app), ayant chacune leurs avantages et inconvénients. Nous essayerons ici d'éclaircir vos ...

Développer une application Na...

Une agence de communication tout ce qu'il faut savoir

Une agence de communication to...

Les secrets d'une stratégie marketing conforme au RGPD sans diminuer vos revenus ?

Le GDPR ou en francais RGPD est l’initiale de Réglement Général pour la Protection des Données et désigne la dernière directive...

Les secrets d'une stratégie m...

Les avantages du Marketing Social

Personne n'aurait pu s’imaginer il y a quelques années à quel point les médias sociaux gagneraient en popularité. Statista révè...

Les avantages du Marketing Soc...