.gitignore for Laravel

22 ignore rules for Laravel, ready to copy into your repository.

PHP web application framework

The complete .gitignore for 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

What these Laravel rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

General

Pattern What it ignores
node_modules/ Node.js dependencies
npm-debug.log General
yarn-error.log General
/vendor/ General

Laravel 4 specific

Pattern What it ignores
bootstrap/compiled.php Laravel 4 specific
app/storage/ Laravel 4 specific

Laravel 5 & Lumen specific

Pattern What it ignores
public/storage Laravel 5 & Lumen specific
public/hot Laravel 5 & Lumen specific

Laravel 5 & Lumen specific with changed public path

Pattern What it ignores
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

How to use this .gitignore for Laravel

  1. Copy the Laravel rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.

Other Framework .gitignore templates

See every Framework template