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

Context Laravel Laravel Package

bonnier/context-laravel

Laravel service provider and middleware for registering a request context. Install via Composer, add the ContextServiceProvider in config/app.php, and enable the RegisterContext middleware in Http/Kernel.php to make context available across your app.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Multi-tenant SaaS architecture: Enables clean separation of tenant-specific data, configurations, and logic without complex middleware or database sharding.
  • Feature flagging & environment isolation: Facilitates A/B testing, regional rollouts, or experimental features by scoping them to specific contexts (e.g., tenant, locale, or user segment).
  • Build vs. buy: Avoids reinventing context management wheels (e.g., custom middleware, database prefixes, or session-based scopes) while offering more flexibility than off-the-shelf SaaS frameworks.
  • Roadmap prioritization: Accelerates development of tenant-aware features (e.g., multi-region support, tenant-specific branding) by providing a reusable foundation.
  • Compliance & data sovereignty: Simplifies adherence to GDPR, CCPA, or regional data laws by isolating data contexts (e.g., EU vs. US tenants).

When to Consider This Package

  • Adopt if:

    • Your Laravel app requires tenant isolation (e.g., SaaS, marketplace) but lacks a unified context layer.
    • You need dynamic feature toggles scoped to tenants, locales, or user roles without heavy middleware.
    • Your team prefers dependency injection over session-based or URL-parameter hacks for context management.
    • You’re building a modular monolith or microservices where context must flow seamlessly across services.
  • Look elsewhere if:

    • You’re using a full-stack SaaS framework (e.g., Filament, Laravel Jetstream) with built-in multi-tenancy.
    • Your context needs are static (e.g., single-tenant apps or hardcoded environments).
    • You require active maintenance (last release in 2020; consider forking or alternatives like spatie/laravel-multitenancy).
    • Your stack is non-Laravel (e.g., Symfony, Django) or heavily relies on database-level isolation (e.g., PostgreSQL schemas).

How to Pitch It (Stakeholders)

For Executives: "This package lets us ship tenant-specific features faster by automating context management—think of it as ‘autopilot for multi-tenancy.’ Instead of writing custom middleware for every new region or feature flag, we’ll use a battle-tested pattern to isolate data, configs, and logic per tenant. This reduces dev time by 30%+ for SaaS expansions and keeps us compliant with global data laws without over-engineering."

For Engineering: *"Context-Laravel gives us a lightweight, DI-friendly way to scope requests to tenants, locales, or user segments. It’s like Laravel’s built-in Auth but for everything—database queries, feature flags, even view overrides. We’d fork it for maintenance, but it’s a drop-in replacement for:

  • Tenant-aware Eloquent queries (no more WHERE tenant_id = X in every model).
  • Dynamic feature toggles (e.g., if (context()->is('eu')) { ... }).
  • Clean separation of concerns (e.g., tenant-specific middleware, service providers). Downside: Unmaintained, but the core pattern is solid and easy to extend."*
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle