Blog

Practical Laravel. Cleaning Up

Laravel by default comes with lots of unneeded bagage, which is better to be cleaned out immediately after installation.

1. Remove All Unneeded Folders

- database - This folder is totally useless for me. I do not trust migrations, and do not use them. I see how it can be useful for newbie developers, but not for me.

- tests - This folder is totally useless for me. I do not write tests. Period.

- resources/assets - Another useless folder, teaching developers bad practices.

2. Remove All Unnecessary Files

- gulpfile.js - Not needing SASS/LESS, sorry

- project.json - Not needing NPM for my PHP, sorry

- phpunit.xml - No tests, sorry

- .gitattributes - Not needed

- server.php - Not needed for me.

3. Include vendor folder in gitignore

Biggest mistake is not incuding the vendor folder. I want all the project dependencies under source control. It will take lots of extra space? Not really, space is either free or cheap these days.

Add the following to the .gitignore to tell GIT to include the vendor folder

!/vendor

You will need to force GIT to unignore the folder

git add - f vendor

Conclusion

Laravel tries to be one stop place for everyone. It tries to please everyone. This is why it comes with all you may think of preinstalled for you.

Make your life easier, leave only what you need. If you write tests, then you leave PHP Unit.

All the unnecessary bits throw away as early as possible, ideally after you install.