Laravel, composer install, don't install laravel/framework
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
Title: Troubleshooting Composer Installation Issues for Laravel Projects
Body:
When developing or working on Laravel projects, you might encounter issues with your composer.json configuration that prevent the successful installation of packages and dependencies. In this comprehensive blog post, we'll walk you through troubleshooting common composer installation problems in Laravel projects and provide solutions for a smoother development process.
1. Check Composer Version and PHP Requirements: Ensure your project is using the latest version of Composer (composer self-update) and that your system meets PHP requirements (PHP >= 5.5.9). If not, either update your Composer or change your PHP configuration accordingly.$ composer --version
Composer version 1.x.x
$ php -v
PHP 7.2.0-1 (cli) (built: Mar 6 05:46:38) (NGINX)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
2. Verify Laravel Framework Version Compatibility: When installing packages through composer, ensure your Laravel framework version is compatible with the dependencies. If you're using Laravel 5.1 as in our example, make sure to set "laravel/framework" to "5.1.*".
{
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
// ... other required packages
}
}
3. Check Package Requirements: Make sure that the dependencies you're installing are compatible with your Laravel framework version and your PHP system. If necessary, update or modify your composer.json file accordingly. In our example, we will require orangehill/iseed dev-master which depends on illuminate/support ~5.3.8:
{
"require": {
"php": ">=5.5.9",
// ... other dependencies
"orangehill/iseed": "dev-master"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
}
4. Update Composer Configuration: If you're still facing issues with dependency installations, try updating your composer configuration by adding the following to your composer.json file:
{
"config": {
"preferred-install": "dist"
}
}
5. Clean and Update Composer Cache: Sometimes, a corrupted cache can cause compatibility issues with dependencies. You may try deleting your composer install directory (composer.lock file) and reinstalling your packages using the following commands:
$ rm -rf vendor/ && composer update
$ rm composer.lock && composer install
6. Consult Laravel Documentation: If everything above doesn't work, consider referring to the official Laravel documentation for troubleshooting and best practices when working with Composer in Laravel projects. You can find helpful guides on managing dependencies, optimizing performance, and resolving conflicts at https://laravelcompany.com/docs/laravel/9.x/installation#configuring-the-package-discover-provider, among others.
In conclusion, troubleshooting installation problems in Laravel projects requires a systematic approach, starting with checking your composer configuration and version compatibility. By following the steps above and consulting official documentation, you can easily resolve any issues encountered during package installation.