What to include in gitignore for a Laravel and PHPStorm project?
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
In web development using Laravel and PHPStorm, the .gitignore file plays a crucial role in ensuring smooth collaboration among team members. This file acts as a guide to tell Git which files or folders should be ignored during version control operations. In this blog post, we'll explore the essential elements of a Laravel-PHPStorm project gitignore and provide insights into other relevant files that might cause conflicts.
# Laravel
/bootstrap/compiled.php
/vendor
/node_modules
composer.phar
composer.lock
.env.*.php
.env.php
.DS_Store
workspace.xml
Thumbs.db
The above list contains the main files and folders to ignore in a Laravel-PHPStorm project. Let's briefly explain each one:
1./bootstrap/compiled.php: This file is generated by the Laravel framework when you run the `composer install` command. It's not necessary to track changes in this file, as it's automatically regenerated during each installation process.
2. /vendor, /node_modules: Any dependencies used in your project are stored here. Since they are downloaded and managed by Composer or NPM, there's no need to version control them.
3. composer.phar, composer.lock: These files hold information about the installed packages for your Laravel project. Tracking changes in them will lead to unnecessary confusion and conflicts when collaborating with other developers.
4. .env.*.php, .env.php: These are configuration files used by Laravel, which may contain sensitive information like database credentials or API keys. Ignoring these files helps prevent accidental exposure of confidential data during Git operations.
5. .DS_Store, workspace.xml: These files are related to macOS and are specific to that operating system's file management system. They store user-specific preferences and should be ignored since they don't contribute to the project itself.
6. Thumbs.db: This is a hidden Windows database used by an application called Live Photo Gallery. It stores thumbnail data for files in that directory. Since it doesn't serve any purpose during development, it can be safely ignored.
Now, let's address the remaining question: Are there any other files that I might be overlooking that could cause conflicts? The answer is not always straightforward but should include any files or folders that are generated by your specific project setup, IDE preferences, or individual development processes.
Conclusion: The given gitignore file provides a solid foundation for version control in Laravel and PHPStorm projects. However, always remember to tailor it according to your specific needs and preferences, as well as the tools you are using. By ignoring unnecessary files and folders, you can ensure smooth collaboration with other team members and maintain a clean and efficient workflow.
Note: When discussing gitignore in Laravel projects, it's essential to differentiate between the .git folder (which contains the project's Git metadata) and the .gitignore file itself. Although not included in the list above, it is recommended to add .git to your gitignore since you don't want Git to track or manage its own repository data.