Install the package via Composer:
composer require vendor/package-name
The Service Provider auto-discovery feature (introduced in v1.1.5) eliminates the need to manually register the provider in config/app.php. Simply publish the configuration file if needed:
php artisan vendor:publish --provider="Vendor\PackageName\PackageServiceProvider" --tag="config"
For a quick test, use the package’s core functionality (e.g., Package::action()) in a controller or command without additional setup.
ServiceProvider is auto-discovered, so no Provider::register() entry is required in config/app.php.php artisan vendor:publish --tag="config"
use Vendor\PackageName\Facades\Package;
$result = Package::doSomething();
boot() method (if you publish the provider class).withEvents() or mock the service container in tests:
$this->app->instance('package.key', $mockInstance);
register() or boot() methods by publishing the provider class (if supported) or extending it.config/services.php or the package’s config.composer.json extra.autoload-dev or autoload sections include the package.return new PackageServiceProvider(); in the auto-discovered file).Provider::register() entry to avoid duplicates.php artisan vendor:publish --provider="Vendor\PackageName\PackageServiceProvider"
Then extend it:
namespace App\Providers;
use Vendor\PackageName\PackageServiceProvider as OriginalProvider;
class PackageServiceProvider extends OriginalProvider {
public function boot() {
parent::boot();
// Custom logic here
}
}
php artisan config:clear
How can I help you explore Laravel packages today?