spatie/one-package-to-rule-them-all
Pulls in all Spatie packages at once so you don’t have to require them individually. Install via Composer, optionally publish the config, and get the full Spatie “magic” in one go for your Laravel app.
Installation:
composer require spatie/one-package-to-rule-them-all
This installs all Spatie Laravel packages listed in the package's composer.json under require.
Publish Configurations (if needed):
Run php artisan vendor:publish --provider="Spatie\OnePackageToRuleThemAll\OnePackageToRuleThemAllServiceProvider" to publish any shared configurations (though this package primarily acts as a meta-package).
Verify Installation:
Check composer.json for newly added Spatie packages (e.g., spatie/laravel-permission, spatie/laravel-activitylog, etc.). Run composer dump-autoload if autoloading issues arise.
Use this package to bulk-install Spatie’s most popular Laravel packages without manually adding each dependency. Ideal for:
Project Bootstrapping:
Add this package first in a new project to avoid repetitive composer require commands later. Example:
composer create-project laravel/laravel my-project
cd my-project
composer require spatie/one-package-to-rule-them-all
Selective Usage:
While the package installs all Spatie packages, disable unused ones via config/spatie.php (if published) or by removing their service providers from config/app.php. Example:
// config/app.php
'providers' => [
// ... other providers
// Spatie\Permission\PermissionServiceProvider::class, // Remove if unused
],
Version Alignment:
The package pins Spatie packages to compatible versions (check the package’s composer.json). For custom versions, manually override in composer.json:
"extra": {
"spatie-packages": {
"spatie/laravel-permission": "4.0.0"
}
}
Testing: Use this package in CI/CD pipelines to ensure all Spatie packages are tested together:
# .github/workflows/test.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: composer require spatie/one-package-to-rule-them-all
- run: composer test
php artisan migrate after installation to set up tables for packages like laravel-permission or laravel-medialibrary.php artisan vendor:publish --tag=spatie-permission-config) for customization.Bloat:
composer.json post-installation.config/app.php and run composer remove spatie/package-name if needed.Version Conflicts:
composer.json for Laravel version constraints.spatie/laravel-permission:^4.0 for Laravel 9).Configuration Overrides:
laravel-activitylog) require manual config publishing. Skipping this may break functionality.php artisan vendor:publish --tag=spatie-activitylog-config explicitly.Testing Overhead:
.env or phpunit.xml to skip irrelevant tests:
<!-- phpunit.xml -->
<exclude>*/Tests/Feature/PermissionTests.php</exclude>
composer dump-autoload if classes (e.g., Spatie\Permission\Permission) are unresolved.config/app.php and test incrementally:
'providers' => [
// Test one provider at a time
Spatie\Permission\PermissionServiceProvider::class,
// Spatie\Activitylog\ActivitylogServiceProvider::class, // Comment out
],
php artisan db:show to verify tables for packages like laravel-permission or laravel-backup.Custom Packages:
Extend the package by adding your own Spatie-like packages to composer.json:
"extra": {
"spatie-packages": {
"your/spatie-package": "1.0.0"
}
}
Then run composer update.
Conditional Installation:
Use composer require with --dev or --optional for environment-specific packages:
composer require spatie/laravel-debugbar --dev
Monorepo Support:
In a monorepo, alias the package in composer.json to avoid global installation:
"repositories": [
{
"type": "path",
"url": "../spatie-packages"
}
]
How can I help you explore Laravel packages today?