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

前端 未结 4 890
挽巷
挽巷 2021-02-07 09:42

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 u

4条回答
  •  醉酒成梦
    2021-02-07 09:51

    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.

提交回复
热议问题