Weave 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

Slim Facades Laravel Package

itsgoingd/slim-facades

Bring Laravel-style facades to Slim Framework. slim-facades adds a lightweight facade layer and service container integration, letting you access container-bound services through clean static interfaces in your routes and controllers, with minimal setup and no framework overhaul.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. slim-facades layers a Laravel-style static façade API over Slim's container (Slim 3's $app->getContainer() / PSR-11 access). It is not a framework, router, or middleware library — it is a thin syntactic convenience layer that resolves container keys via a statically registered container (Facade::setFacadeContainer()), with a companion middleware to bind the per-request instance. Architecturally it fits only if the team has already committed to Slim and wants Laravel-shaped call sites (Router::get(...), View::render(...), Log::info(...), Request::getParam(...)) instead of constructor injection. It is a poor fit for greenfield work where explicit DI, PSR-11 typing, and testable boundaries are the norm; the façade indirection actively pushes against that.

Integration feasibility. Low effort to adopt mechanically: one composer require, one bootstrap line to register the container, optionally one middleware added to the stack. No schema, no config tree, no service provider contract. The real cost is not installation but the discipline it erodes — static calls bypass the container graph, so dependency visibility and IDE-level traceability degrade immediately.

Technical risk.

  • Slim version coupling (highest risk). The package targets the Slim 3 lifecycle where a container is attached to the app. Slim 4 removed that model in favor of app-level PSR-11 wiring and immutable request/response objects passed explicitly through middleware. If the target stack is Slim 4, expect the façade's Request/Response accessors to be semantically wrong (mutable $request->getParam() assumptions, no response object to mutate). Verify composer.json constraints before anything else.
  • Static global state. A process-global container reference is safe under PHP-FPM (request-scoped process) but is a genuine hazard under RoadRunner, Swoole, or any long-lived worker: a stale container or stale request can leak across requests unless the middleware reliably rebinds and resets on every cycle.
  • Maintenance signal. 74 stars and a single maintainer (itsgoingd, better known for Clockwork). Activity is sparse. This is a convenience dependency, so blast radius is contained, but you should assume you may vendor it.
  • Hidden dependency inversion. Facades make it trivially easy to call Request:: from a domain service, at which point unit tests require bootstrapping a container — a classic testability regression.

Key questions.

  1. Which Slim major version is in scope, and does the package's constraint actually admit it?
  2. Is the runtime PHP-FPM (safe) or RoadRunner/Swoole (requires per-request rebinding proof)?
  3. Does the team have existing Laravel façade familiarity, or is this introducing an unfamiliar idiom into a Slim codebase?
  4. What is the test strategy for code that calls façades — container-backed integration tests only, or is there a mock/swap story?
  5. Is there an existing DI convention (e.g., PHP-DI, League\Container) that this would duplicate or conflict with?

Integration Approach

Stack fit. Best fit: Slim 3 + a Laravel-influenced team porting patterns or building an internal admin/API service where developer velocity matters more than architectural purity. Poor fit: Slim 4, or any codebase with an enforced "constructor injection only" standard. Confirm PHP version alignment with Slim's own constraints, and confirm the PSR-11 container used (Pimple in Slim 3, PHP-DI/League\Container commonly in Slim 4) exposes the keys the façades expect — router, view, logger, settings, request, response.

Migration path. Introduce behind a boundary: allow façades in the HTTP edge layer (routes, controllers, middleware) and forbid them below it (domain, repositories, services). Enforce mechanically with a PHPStan/Psalm rule or a simple grep-based CI check. This gives you the ergonomic win without the testability debt. If you later need to remove the package, the migration is a bounded refactor of the edge layer only.

Compatibility. Verify the package's Slim constraint against your pinned version first — this is a go/no-go gate, not a detail. Then verify container key names match your bootstrap (the façades resolve by key, so a renamed service silently breaks at runtime, not at install). Check interaction with any existing middleware that replaces or wraps the request object; the façade middleware must sit at a position where it sees the request you actually want to expose.

Sequencing.

  1. Version/compatibility spike (½ day) — confirm Slim major and container keys.
  2. Prototype in one route group; validate façade behavior for router, request, view, log.
  3. Establish the edge-layer-only policy and the CI guard before broader rollout.
  4. Roll out to controllers/middleware; explicitly exclude domain and CLI/queue entry points (there is no request there, and the static container will be unset).
  5. If running a long-lived worker, add and test an explicit reset in the middleware cycle.

Operational Impact

Maintenance. Very low ongoing maintenance from you — no config, no migrations, no background jobs. The dependency itself is the maintenance question: with a single maintainer and low activity, plan for the realistic possibility of pinning a version indefinitely or vendoring the ~small source into your repo. Budget a periodic compatibility check on every Slim major bump.

Support. No commercial backing, no SLA. Internal support means one or two engineers who understand the façade-to-container resolution; document the bootstrap line and the middleware position, because misordering it produces confusing null-request failures that look like framework bugs.

Scaling. Horizontally neutral — it adds no I/O, no state store, no network hop. Per-request overhead is a static lookup. The scaling concern is vertical/runtime-shaped, not load-shaped: under RoadRunner/Swoole the static container is a correctness risk under concurrency, so scaling the runtime model forces you to solve state rebinding first.

Failure modes.

  • Unset container — façade called from CLI, queue worker, or before bootstrap: fatal or null. Predictable, loud, easy to diagnose.
  • Missing container key — a typo'd or renamed service resolves to null at call time rather than at boot; silent until the specific code path runs.
  • Middleware ordering — request/response façades return stale or null values if the façade middleware is not positioned correctly relative to body-parsing and routing middleware.
  • Cross-request leakage — long-lived workers retaining a prior request instance. Highest-severity failure mode because it is intermittent and data-dependent.
  • Version drift — composer update pulls a Slim major that the façades do not understand, producing subtle request-mutability bugs rather than a clean install failure.

Ramp-up. Near zero for engineers with Laravel experience — the idiom is identical. For engineers without it, expect a short but real adjustment: the façade looks like a global, so the "where does this actually come from" question recurs. Mitigate with a one-page internal standard (which façades are permitted, where, and why domain code must not use them) rather than relying on code review alone. Net: adoption cost is low, but the governance cost is non-zero and must be paid deliberately or the package quietly undermines the container architecture it sits on.

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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator