dhorrigan/capsule
Capsule is a Laravel/PHP package by Dan Horrigan that provides a lightweight way to encapsulate reusable application logic. It integrates cleanly with Laravel, helps keep code organized, and makes components easier to test, extend, and maintain across projects.
Architecture fit. The package addresses a real and recurring need: bringing Eloquent and the query builder into a non-Laravel PHP codebase — legacy monoliths, CLI/cron entrypoints, WordPress plugins, standalone worker services. But the capability is already native to illuminate/database via Illuminate\Database\Capsule\Manager, which has shipped addConnection / setAsGlobal / bootEloquent since Laravel 4.1. This package is a wrapper over that manager, so its architectural contribution is redundant on any modern Illuminate version. The real architectural decision on the table is "do we standardize on Eloquent outside Laravel?" — this package is only packaging around that answer, and a worse form of the packaging than the first-party one.
Integration feasibility. Technically near-zero effort: Composer-installable, tiny public surface, no service provider or container coupling, works with existing PSR-4 autoloading. The blocker is lifecycle, not complexity. With zero stars, zero dependents, and a zero score, this is an unmaintained artifact. It is almost certainly pinned to an end-of-life Illuminate 4.x line, which transitively constrains PHP compatibility and blocks security patching across the stack. Composer resolution against a modern PHP 8.x runtime is the first thing that will fail.
Technical risk.
dhorrigan/capsule) and the linked repository (philsturgeon/capsule) do not match. That must be resolved before anything else — it is a due-diligence gate, not a footnote.illuminate/database pins the ORM, which pins PHP, which pins our ability to patch the rest of the stack.Key questions for the team.
illuminate/database does not already provide?composer.lock, or is this a greenfield adoption proposal?Stack fit. PHP + Composer only. Appropriate for non-Laravel applications that want Eloquent models and the query builder without the framework. Explicitly inappropriate for anything already on Laravel, where Capsule is bootstrapped for you, and inappropriate as a platform standard anywhere.
Migration path. Treat the package as an adapter, never a foundation. The preferred path is to not take the dependency at all and use the native manager directly:
$capsule = new \Illuminate\Database\Capsule\Manager;
$capsule->addConnection($config);
$capsule->setAsGlobal();
$capsule->bootEloquent();
If the package is already present, the substitution is close to drop-in. The safe sequencing is to put an internal interface (e.g. DatabaseBootstrapper) in front of it first, bind the current wrapper behind that interface, then swap the implementation without touching call sites.
Compatibility. Verify four things in a throwaway branch before any commitment: (a) PHP constraint vs. our runtime floor; (b) illuminate/database constraint vs. everything else in composer.json; (c) PSR-4 mapping and class-name overlap with the native Capsule; (d) PDO driver availability for the target databases. Run composer why-not first — if resolution fails, the evaluation ends there and we have lost an hour, not a sprint.
Sequencing.
composer audit.illuminate/database + native Capsule\Manager.Maintenance. Assume the full maintenance burden transfers to us on day one. Budget either a vendored fork with a named internal owner and a written patch policy, or a removal ticket with a target date. Do not let it sit as an unowned transitive dependency — that is exactly the failure pattern this package invites.
Support. No community, no downstream consumers, no issue triage, no StackOverflow corpus. All institutional knowledge has to be written down internally. Laravel-fluent engineers will ramp on the code in one to two days because the underlying APIs are familiar; the real cost is organizational — the decision to own dead software, and the review overhead of explaining to future engineers why a wrapper exists over a first-party class that does the same thing.
Scaling. Architecturally neutral: throughput and memory characteristics are entirely Illuminate's. The gaps are operational, not performance. There is no connection pooling, and in long-lived process models the global capsule holds connections open across requests or jobs, so explicit disconnect/reconnect handling is required per job to avoid connection exhaustion and stale-connection errors after DB failover. Connection configuration is passed as raw arrays, which means settings will drift from the conventions the rest of the org documents.
Failure modes to instrument for.
Recommendation. Do not adopt as a new dependency. Approve a time-boxed spike (one to two days) only to validate that Eloquent outside Laravel delivers value for the target codebase; if it does, depend on illuminate/database directly with a pinned version and the native Capsule\Manager. If the package is already present, schedule replacement within one to two sprints — the substitution is small and removes an unmaintained pin from the dependency graph. Success criteria for the spike: Eloquent models and migrations working against the target database in a non-Laravel context, a documented exit path, and a pinned, provenance-verified dependency.
How can I help you explore Laravel packages today?