.gitignore pour Laravel

22 règles d’exclusion pour Laravel, prêtes à copier dans votre dépôt.

Framework d'application web PHP

Le .gitignore complet pour Laravel

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2025-08-14 10:26:37 UTC
# Technologies: Laravel

### Laravel ###
# Node.js dependencies
node_modules/
npm-debug.log
yarn-error.log
bootstrap/compiled.php
app/storage/
public/storage
public/hot
public_html/storage
public_html/hot
storage/*.key
# Environment variables
.env
Homestead.yaml
Homestead.json
/.vagrant
/vendor/
.phpunit.result.cache
/public/build
/storage/pail
.env.backup
.env.production
.phpactor.json
auth.json

Ce que ces règles Laravel ignorent vraiment

Chaque motif ci-dessous, et pourquoi il a sa place dans votre .gitignore.

General

Motif Ce qu’il ignore
node_modules/ Node.js dependencies
npm-debug.log General
yarn-error.log General
/vendor/ General

Laravel 4 specific

Motif Ce qu’il ignore
bootstrap/compiled.php Laravel 4 specific
app/storage/ Laravel 4 specific

Laravel 5 & Lumen specific

Motif Ce qu’il ignore
public/storage Laravel 5 & Lumen specific
public/hot Laravel 5 & Lumen specific

Laravel 5 & Lumen specific with changed public path

Motif Ce qu’il ignore
public_html/storage Laravel 5 & Lumen specific with changed public path
public_html/hot Laravel 5 & Lumen specific with changed public path
storage/*.key Laravel 5 & Lumen specific with changed public path
.env Environment variables
Homestead.yaml Laravel 5 & Lumen specific with changed public path
Homestead.json Laravel 5 & Lumen specific with changed public path
/.vagrant Laravel 5 & Lumen specific with changed public path
.phpunit.result.cache Laravel 5 & Lumen specific with changed public path
/public/build Laravel 5 & Lumen specific with changed public path
/storage/pail Laravel 5 & Lumen specific with changed public path
.env.backup Laravel 5 & Lumen specific with changed public path
.env.production Laravel 5 & Lumen specific with changed public path
.phpactor.json Laravel 5 & Lumen specific with changed public path
auth.json Laravel 5 & Lumen specific with changed public path

Comment utiliser ce .gitignore pour Laravel

  1. Copiez les règles Laravel ci-dessus, ou téléchargez directement le fichier.
  2. Créez un fichier nommé .gitignore à la racine de votre dépôt Git et collez-y les règles.
  3. Si certains de ces fichiers sont déjà suivis, lancez git rm -r --cached . puis recommitez — Git n’applique les règles d’exclusion qu’aux fichiers non suivis.
  4. Commitez le .gitignore pour que toute l’équipe partage les mêmes règles.

Autres modèles .gitignore Framework

Voir tous les modèles Framework