New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

equidna/bee-hive

Reusable multi-tenant foundation for Laravel applications.
4,643

Larablocks Analysis

equidna/bee-hive works with Laravel 12 and 13 (latest release 3.1.0, Aug 26, 2026).

Promising: maintained and up to date, meets 2 of 4 checks; not yet widely used.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Aug 26, 2026)
  • 451 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Actively maintained
  • Last stable release: Aug 26, 2026.
  • 4 releases in the last 12 months.
  • First released: Apr 20, 2026.
  • Monthly downloads: 451.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.

Install
composer require equidna/bee-hive
Latest Version:3.1.0
PHP:^8.2
Laravel:12 · 13
License:proprietary
Last Updated:Aug 26, 2026
Links: GitHub  ·  Packagist
Maintainer: gruelas

equidna/bee-hive

Reusable multi-tenant foundation package for Laravel projects.

Compatibility

BeeHive Laravel PHP Symfony HTTP Foundation
3.x 12.x 8.2+ 7.2+ as resolved by Laravel
3.x 13.x 8.3+ 7.4 on PHP 8.3; 7.4 or 8.x on PHP 8.4+

BeeHive is server-side infrastructure and has no dependency on Inertia. It can be used unchanged in Laravel applications that install inertiajs/inertia-laravel. The CI compatibility lanes exercise Laravel 12, Laravel 13 with Symfony 7.4, and Laravel 13 with Symfony 8 independently. Dependency auditing runs on the current Laravel 13/Symfony 8 lane; Symfony 7 compatibility lanes remain visible even when Composer temporarily blocks all available Symfony 7 releases because of an upstream advisory.

What It Includes

  • Tenant resolver contract
  • Tenant context container
  • Eloquent global scope for tenant filtering
  • BelongsToTenant trait with automatic tenant key fill
  • Service provider with publishable config

Architecture

flowchart LR
	A[Laravel Container] --> B[BeeHiveServiceProvider]
	B --> C[TenantResolverInterface]
	C --> D[Configured Resolver]
	D --> E[TenantContext]

	E --> F[TenantScope]
	E --> G[BelongsToTenant Trait]

	F --> H[Query Filtering by tenant key]
	G --> I[Auto-fill tenant key on create]

	F --> J{Tenant ID resolved?}
	J -->|Yes| H
	J -->|No| L[BeeHiveException]
	L --> M[RFC 7807 Problem Details Response]

Flow summary:

  1. The service provider binds the configured tenant resolver and initializes TenantContext.
  2. TenantScope reads the tenant from context to enforce query-level isolation.
  3. BelongsToTenant uses the same context to auto-assign tenant key values on model creation.
  4. Missing tenant resolution always throws BeeHiveException with an RFC 7807 problem_details JSON response.

Error Response

When tenant resolution fails, BeeHiveException returns an RFC 7807 problem_details JSON response:

{
  "type": "urn:beehive:error:tenant_not_resolved",
  "title": "BeeHive Exception",
  "status": 422,
  "detail": "BeeHive tenant was not resolved.",
  "code": "tenant_not_resolved"
}

Config keys (in config/bee-hive.php):

  • errors.status: HTTP status code for tenant resolution errors (default: 422)
  • logging.enabled: enable package log emission (default: true)
  • logging.level: package log level (warning by default)
  • logging.sample_rate: sampling ratio between 0 and 1 (default: 1.0)

Environment variables:

  • BEE_HIVE_ERROR_STATUS
  • BEE_HIVE_LOGGING_ENABLED
  • BEE_HIVE_LOG_LEVEL
  • BEE_HIVE_LOG_SAMPLE_RATE

Quality Checks

Run repository quality checks locally:

  • composer validate --no-check-publish
  • composer audit --no-interaction
  • ./vendor/bin/phpcs --standard=ruleset.xml src config tests
  • ./vendor/bin/phpstan analyse --memory-limit=512M
  • ./vendor/bin/phpunit

CI additionally runs workflow linting (actionlint) and separate framework lanes for Laravel 12/Symfony 7.2, Laravel 13/Symfony 7.4, and Laravel 13/Symfony 8.

Or run the aggregated command:

  • composer qa
  • composer qa:fast for validate + lint + tests without audit/static analysis

Security Behavior

  • Tenant-scoped reads and writes require a resolved tenant.
  • Missing tenant resolution throws BeeHiveException.
  • Model creation always applies the resolved tenant value, even if a different tenant value is provided in input.

Observability

BeeHive logs warning events when:

  • A tenant-scoped query runs without a resolved tenant.
  • A tenant-scoped model is created without a resolved tenant.
  • A model create payload includes a tenant value different from the resolved context.

Each event includes a stable event_code field for alerting and dashboard rules.

Sampling behavior (logging.sample_rate) is tested deterministically in the test suite to avoid flaky observability checks.

The emitted package level still passes through the global Laravel logging configuration (channels, handlers, and minimum levels).

Event Catalog

event_code Trigger Suggested severity Context fields
BEEHIVE_TENANT_UNRESOLVED_QUERY A tenant-scoped query runs without a resolved tenant warning model, tenant_key, resolver
BEEHIVE_TENANT_UNRESOLVED_CREATE A tenant-scoped model create operation runs without a resolved tenant warning model, tenant_key
BEEHIVE_TENANT_SPOOF_ATTEMPT Input tenant differs from resolved tenant during create warning model, tenant_key, incoming_tenant_id, resolved_tenant_id

Suggested alerting thresholds:

  • Alert immediately on any sustained BEEHIVE_TENANT_UNRESOLVED_QUERY volume in production.
  • Investigate any BEEHIVE_TENANT_SPOOF_ATTEMPT event as potentially malicious client behavior.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
3.1.0 ^8.2 ^12.0 || ^13.0 proprietary
3.0.0 ^8.2 ^12.0 proprietary
2.0.0 ^8.2 ^12.0 proprietary
1.0.0 ^8.2 ^12.0 proprietary