Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

One Package To Rule Them All Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. 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.

  2. 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).

  3. 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.

First Use Case

Use this package to bulk-install Spatie’s most popular Laravel packages without manually adding each dependency. Ideal for:

  • New Laravel projects where you anticipate needing multiple Spatie packages (e.g., permissions, media library, activity logs).
  • Legacy projects requiring a unified upgrade path for Spatie packages.

Implementation Patterns

Workflows

  1. 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
    
  2. 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
    ],
    
  3. 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"
        }
    }
    
  4. 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
    

Integration Tips

  • Database Migrations: Run php artisan migrate after installation to set up tables for packages like laravel-permission or laravel-medialibrary.
  • Configuration: Publish individual package configs (e.g., php artisan vendor:publish --tag=spatie-permission-config) for customization.
  • Documentation: Refer to each Spatie package’s docs (e.g., laravel-permission) for usage specifics.

Gotchas and Tips

Pitfalls

  1. Bloat:

    • The package installs ~20+ Spatie packages, increasing bundle size and potential conflicts. Audit composer.json post-installation.
    • Mitigation: Remove unused packages from config/app.php and run composer remove spatie/package-name if needed.
  2. Version Conflicts:

    • Spatie packages may have incompatible dependencies (e.g., Laravel 8 vs. 9). Check the package’s composer.json for Laravel version constraints.
    • Mitigation: Use Laravel’s version-specific branches (e.g., spatie/laravel-permission:^4.0 for Laravel 9).
  3. Configuration Overrides:

    • Some packages (e.g., laravel-activitylog) require manual config publishing. Skipping this may break functionality.
    • Tip: Run php artisan vendor:publish --tag=spatie-activitylog-config explicitly.
  4. Testing Overhead:

    • Testing all installed packages can slow down CI. Use .env or phpunit.xml to skip irrelevant tests:
      <!-- phpunit.xml -->
      <exclude>*/Tests/Feature/PermissionTests.php</exclude>
      

Debugging

  • Autoload Errors: Run composer dump-autoload if classes (e.g., Spatie\Permission\Permission) are unresolved.
  • Service Provider Conflicts: Disable providers in config/app.php and test incrementally:
    'providers' => [
        // Test one provider at a time
        Spatie\Permission\PermissionServiceProvider::class,
        // Spatie\Activitylog\ActivitylogServiceProvider::class, // Comment out
    ],
    
  • Database Issues: Use php artisan db:show to verify tables for packages like laravel-permission or laravel-backup.

Extension Points

  1. 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.

  2. Conditional Installation: Use composer require with --dev or --optional for environment-specific packages:

    composer require spatie/laravel-debugbar --dev
    
  3. Monorepo Support: In a monorepo, alias the package in composer.json to avoid global installation:

    "repositories": [
        {
            "type": "path",
            "url": "../spatie-packages"
        }
    ]
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport