Speeding Up Laravel Tests with tmpfs (MySQL in RAM)
If your Laravel test suite is painfully slow and does a lot of database work (multi-tenancy, migrations, seeding), the bottleneck is almost…
When running composer install without any flags, all dependencies are installed - including development packages that have no place in a production environment.
Running composer without proper flags in production creates several critical issues. Your production servers will contain unnecessary development packages, potentially exposing development tools in your production environment. This not only wastes disk space but can also impact your application's performance. More concerning is the potential security vulnerability from exposed debug information.
If you've accidentally run composer install in Production Without --no-dev, remove all dependencies and perform a clean installation with production-specific flags:
rm -rf vendor/
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
--no-dev ensures development dependencies are excluded from installation, keeping your production environment lean and secure.
--no-interaction prevents composer from asking interactive questions during the installation process, making it suitable for automated deployments.
--prefer-dist tells composer to use optimized package archives, improving installation performance.
--optimize-autoloader generates an optimized autoloader, enhancing your application's performance.
Include these flags in your deployment automation script (e. g. on Laravel Forge) to ensure consistent, secure deployments:
cd /path/to/project
git pull origin main
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
You can verify that development packages are not installed by checking for the presence of development-only packages in your vendor directory, e.g.:
ls vendor/barryvdh/laravel-debugbar
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com