I'm installing the spatie\laravel-backup
package. According to the instructions, I just need to composer require spatie\laravel-backup
and the package should be recognized and auto-installed. It looks like this is happening:
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: spatie/laravel-backup
But looking in /config/app.php
there's no mention of backup
anywhere in the providers, and the expected /config/backup.php
configuration file isn't found.
Are there any additional commands I need to issue to complete the auto-discovery?
But looking in /config/app.php there's no mention of backup anywhere in the providers, and the expected /config/backup.php configuration file isn't found.
Laravel 5.5 does not modify your configuration files when it discovers packages. We only need to add service provider entries and facade aliases to config/app.php when manually registering a package's services.
Package discovery works by reading vendor/composer/installed.json to find autoloadable packages. It then saves a cached manifest file that the application reads when it boots to load the package providers and aliases (typically in bootstrap/cache/packages.php).
We can reload this cached package manifest file by running:
php artisan package:discover
Package discovery does not publish a package's assets, such as the configuration file you describe. The developer must explicitly run the vendor:publish
command:
php artisan vendor:publish --provider='Spatie\Backup\BackupServiceProvider'
This limitation is by design. Laravel has no way to know if the developer wants to publish a package's components, because, in many cases, packages provide optional components and the developer can choose which ones to publish.