Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to include in gitignore for a Laravel and PHPStorm project?

I'm going to be collaborating on a project using Laravel and PHPStorm. After doing some research and working on a few projects, here is the .gitignore I've come up with so far.

/bootstrap/compiled.php
/vendor
/node_modules
composer.phar
composer.lock
.env.*.php
.env.php
.DS_Store
workspace.xml
Thumbs.db

Are there any other files that I might be overlooking that could cause conflicts?

EDIT:

For anyone wondering why Flosculus comment is there, I originally posted that I was having issues with the .idea/workspace file showing up in my git history, and his answer is how to remove it.

like image 281
jkjmr6 Avatar asked Sep 09 '14 15:09

jkjmr6


2 Answers

Unless PHPStorm is an official part of the project (e.g. it's mandated by a company, or agreed to by all team members) I would urge you to put its ignore settings into .git/info/exclude instead of .gitignore. The former is local to your copy, the latter should be committed and shared.

gitignore.io suggests this for Laravel:

# Created by https://www.gitignore.io/api/laravel

### Laravel ###
vendor/
node_modules/
npm-debug.log

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
public/storage
public/hot
storage/*.key
.env.*.php
.env.php
.env
Homestead.yaml
Homestead.json

# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
.rocketeer/

and this for PHPStorm:

# Created by https://www.gitignore.io/api/phpstorm

### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

As an aside, gitignore.io can be accessed via the command-line, so you can do things like

gi laravel,phpstorm >> .gitignore

It's a pretty handy little tool.

like image 174
Chris Avatar answered Sep 21 '22 13:09

Chris


Laravel automatically create it after installation:

/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
like image 29
mwafi Avatar answered Sep 22 '22 13:09

mwafi