- What is dhorrigan/capsule used for?
- The package describes itself as a Laravel package for encapsulating reusable application logic into focused, testable capsule classes to keep controllers and models lean. A technical evaluation, however, identifies it as a thin wrapper over Illuminate\Database\Capsule\Manager, aimed at bringing Eloquent and the query builder to non-Laravel PHP codebases. On any modern Illuminate version that native manager already provides the same capability, so the wrapper's architectural value is limited. Treat the capsule-classes description as marketing rather than a unique feature.
- How do I install dhorrigan/capsule with Composer?
- You would normally run composer require dhorrigan/capsule, but verify provenance before doing so because the Composer name and the linked philsturgeon/capsule repository do not match. The package has no visible test suite and zero dependents, so installation is low-effort but lifecycle risk is high. For a greenfield project, install illuminate/database directly and use the native Capsule Manager instead.
- Is dhorrigan/capsule still maintained and safe for production?
- The evaluation flags it as an unmaintained artifact with zero stars, zero dependents, and no release cadence or CVE response path. It is likely pinned to an end-of-life Illuminate 4.x line, which drags PHP compatibility and blocks security patching across the stack. Adopting it effectively means vendoring code your team owns, so production use is not recommended without a named maintainer and fork plan.
- Does dhorrigan/capsule work with Laravel 10, Laravel 11, or PHP 8.2?
- Very likely not. The package appears constrained to old Illuminate 4.x, which implies a PHP floor incompatible with modern Laravel and PHP 8 runtimes, and Composer resolution against PHP 8.x is expected to fail first. Before any commitment, verify the illuminate/database constraint against everything else in composer.json in a throwaway branch.
- What is the difference between dhorrigan/capsule and Illuminate\Database\Capsule\Manager?
- Illuminate\Database\Capsule\Manager is the first-party class that has shipped in illuminate/database since Laravel 4.1, with addConnection, setAsGlobal, and bootEloquent. Dhorrigan/capsule is a wrapper around that manager, so it adds packaging rather than capability. Running both in one codebase risks autoload ambiguity and dual global capsule state, where queries can hit the wrong connection.
- How do I use Eloquent outside Laravel without dhorrigan/capsule?
- Instantiate the native manager directly: $capsule = new \Illuminate\Database\Capsule\Manager; then call $capsule->addConnection($config), $capsule->setAsGlobal(), and $capsule->bootEloquent(). That is the same bootstrapping the wrapper performs, with no third-party dependency or version-pin drag. It works with existing PSR-4 autoloading and requires no service provider.
- Why does the Composer package dhorrigan/capsule point to the philsturgeon/capsule GitHub repository?
- The mismatch is a supply-chain provenance red flag. The Composer name and the linked repository should line up, and until that discrepancy is resolved, you cannot confidently attribute the code to a maintainer or audit its history. Resolve it as a due-diligence gate before considering adoption, not as a footnote.
- Can I use dhorrigan/capsule inside a Laravel application?
- You can, but it is redundant. Laravel already bootstraps the native Capsule Manager for you, and the package is explicitly inappropriate for anything already running the framework. For organizing business logic in Laravel, use actions, service classes, or pipelines instead of adding an unmaintained wrapper.
- How do I migrate away from dhorrigan/capsule in an existing codebase?
- Put an internal interface such as DatabaseBootstrapper in front of the package, bind the current wrapper behind it, then swap the implementation to native Illuminate\Database\Capsule\Manager without touching call sites. The substitution is close to drop-in because the wrapper delegates to the same manager. Verify PSR-4 mapping, class-name overlap with the native Capsule, and PDO driver availability in a throwaway branch first.
- What are alternatives to dhorrigan/capsule for organizing Laravel business logic?
- For Laravel apps, use first-party patterns such as action classes, service classes, pipelines, or domain services rather than an extra package. For non-Laravel apps that need Eloquent, use illuminate/database directly with the native Capsule Manager. If you want the capsule naming, write small, testable classes in your own namespace and inject them through the container.