I've now set up a Laravel development environment using Sail (switching from Homestead) to try it out.
I've got a very basic app running but I'm having problems with composer creating different errors depending on packages installed.
I'm using sail composer... to run the composer commands
I've just tried to install barryvdh/laravel-debugbar. When I do it comes up with an error:
In RecursiveDirectoryIterator.php line 48:
RecursiveDirectoryIterator::__construct(/var/www/html/vendor/barryvdh/laravel-debugbar): Failed to open directory: Not a directory
The folder does exist in my project.
If I then remove the package I then get a new error:
In PhpFileParser.php line 51:
File at "/var/www/html/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php" does not exist, check your classmap definitions
And on checking in the project again that file exists
I've had similar errors with other packages and needed to remove and reinstall, removing the vendor directory completely as well - something is not right when running composer within Docker
I'm also starting to get namespace errors for my models after this aborted install - Models/User not found
Here is my composer file:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1",
"barryvdh/laravel-ide-helper": "*",
"blade-ui-kit/blade-ui-kit": "^0.4.0",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/jetstream": "^3.1",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"livewire/livewire": "^2.11",
"maatwebsite/excel": "^3.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
I'm not sure where to start looking to fix and ensure composer is stable