laravel-rebel-admin-api
GitHub repository · Composer: padosoft/laravel-rebel-admin-api · MIT
The read models behind your security operations. A JSON API that turns
rebel_auth_events
into overview metrics, an audit-event explorer, OTP/step-up funnels and provider health — every
endpoint permission-gated and tenant-scoped. API only, no UI.
What it is
The control-plane API for the Laravel Rebel suite. It projects raw audit events into queryable read
models — overviews, funnels, anomalies, channel and provider health, compliance and subject lookups —
and serves them over a clean JSON surface guarded by the EnsureAdmin middleware. It is deliberately
headless: bring your own UI, or pair it with laravel-rebel-admin for the ready-made panel.
The problem it solves
The audit trail in rebel_auth_events is honest and complete, but it’s raw. Answering “what’s our
OTP delivery rate this week?”, “where are users dropping out of step-up?” or “which provider is
degraded right now?” means aggregation, time bucketing, and — critically — making sure an admin only
sees their own tenant’s data. This package builds those read models once, behind permission checks and
tenant scoping, so you never hand-roll a dashboard query against sensitive event data again.
What you get
| Capability | Endpoint surface |
|---|---|
| Overview & metrics | OverviewController, MetricsProjector, MetricBucket — time-bucketed security KPIs. |
| Audit-event explorer | AuthEventsController — query and drill into rebel_auth_events. |
| Funnels | FunnelController — OTP / step-up conversion and drop-off. |
| Anomalies | AnomaliesController — anomaly cases surfaced for review. |
| Channels & providers | ChannelsController, ProvidersController, HealthController — delivery and provider health. |
| Risk rules | RiskRulesController, RiskRuleEvaluator, RiskRule — configurable rule read/write. |
| Compliance & subjects | ComplianceController, SubjectsController, MeController. |
| Settings & copilot | SettingsController (AdminSetting), AiCopilotController. |
| Guarded & scoped | EnsureAdmin middleware + ResolvesTenant — permission-gated, tenant-scoped. |
When to use it
- You want security KPIs and funnels without writing aggregation queries against raw events.
- You’re building a custom admin UI and need a stable, guarded JSON contract to call.
- You need read models that are tenant-scoped and permission-gated out of the box.
- You’re installing
laravel-rebel-admin(the panel) — it sits on top of this API.
Worked example
composer require padosoft/laravel-rebel-admin-api
php artisan vendor:publish
php artisan migrate
Routes are registered from the package’s routes/api.php behind the EnsureAdmin middleware. Build
metric buckets with the bundled command:
php artisan rebel:project-metrics
How it fits
The admin API is the read side of the suite. It consumes the audit trail from
laravel-rebel-core, projects it into MetricBucket and related models, and serves it to whatever
front-end you choose. laravel-rebel-admin is the official consumer; the AI guard reads the same
buckets and rules. Everything stays tenant-scoped and permission-gated by construction.
A control-plane API that’s headless, tenant-scoped and built directly on an auditable event store is
the hard part most dashboards skip — see Why Rebel.
Reference
Runtime files
src\Console\ProjectMetricsCommand.phpsrc\Http\Concerns\ResolvesTenant.phpsrc\Http\Controllers\AiCopilotController.phpsrc\Http\Controllers\AnomaliesController.phpsrc\Http\Controllers\AuthEventsController.phpsrc\Http\Controllers\ChannelsController.phpsrc\Http\Controllers\ComplianceController.phpsrc\Http\Controllers\FunnelController.phpsrc\Http\Controllers\HealthController.phpsrc\Http\Controllers\MeController.phpsrc\Http\Controllers\OverviewController.phpsrc\Http\Controllers\ProvidersController.phpsrc\Http\Controllers\RiskRulesController.phpsrc\Http\Controllers\SettingsController.phpsrc\Http\Controllers\SubjectsController.phpsrc\Http\Middleware\EnsureAdmin.phpsrc\Metrics\MetricsProjector.phpsrc\Models\AdminSetting.phpsrc\Models\MetricBucket.phpsrc\Models\RiskRule.phpsrc\Risk\RiskRuleEvaluator.phpsrc\Support\AdminAudit.phpsrc\Support\Period.phpsrc\RebelAdminApiServiceProvider.php
Service providers
src\Http\Controllers\ProvidersController.phpsrc\RebelAdminApiServiceProvider.php
Services and managers
src\RebelAdminApiServiceProvider.php
Contracts
None detected in the package tree.
Controllers
src\Http\Controllers\AiCopilotController.phpsrc\Http\Controllers\AnomaliesController.phpsrc\Http\Controllers\AuthEventsController.phpsrc\Http\Controllers\ChannelsController.phpsrc\Http\Controllers\ComplianceController.phpsrc\Http\Controllers\FunnelController.phpsrc\Http\Controllers\HealthController.phpsrc\Http\Controllers\MeController.phpsrc\Http\Controllers\OverviewController.phpsrc\Http\Controllers\ProvidersController.phpsrc\Http\Controllers\RiskRulesController.phpsrc\Http\Controllers\SettingsController.phpsrc\Http\Controllers\SubjectsController.php
Middleware
src\Http\Middleware\EnsureAdmin.php
Models
src\Models\AdminSetting.phpsrc\Models\MetricBucket.phpsrc\Models\RiskRule.php
Config
config\rebel-admin-api.php
Migrations
database\migrations\create_rebel_admin_settings_table.phpdatabase\migrations\create_rebel_metric_buckets_table.phpdatabase\migrations\create_rebel_risk_rules_table.php
Routes
routes\api.php
Commands
src\Console\ProjectMetricsCommand.php
Composer requirements
| Dependency | Constraint |
|---|---|
illuminate/contracts |
`^12.0 |
illuminate/support |
`^12.0 |
padosoft/laravel-rebel-core |
^0.1 |
php |
^8.3 |
spatie/laravel-package-tools |
^1.92 |
Development requirements
| Dependency | Constraint |
|---|---|
larastan/larastan |
^3.0 |
laravel/pint |
^1.18 |
orchestra/testbench |
`^10.0 |
padosoft/laravel-rebel-ai-guard |
^0.1 |
padosoft/laravel-rebel-sessions |
^0.1 |
padosoft/laravel-rebel-step-up |
^0.1 |
pestphp/pest |
^4.0 |
pestphp/pest-plugin-laravel |
^4.0 |
Architecture decisions
Problem: keep laravel-rebel-admin-api replaceable
Decision: document its public responsibility and use Rebel core contracts at integration boundaries.
Consequences: applications can adopt the package without coupling every other Rebel module to its internals.
Problem: package-specific behavior must remain auditable
Decision: all security-significant outcomes should emit or feed audit events through the core vocabulary.
Consequences: admin API, admin UI and AI guard can reason across packages without bespoke parsers for every provider.
Test & verification surface
tests\Feature\AdminGateTest.phptests\Feature\AiCopilotTest.phptests\Feature\AnomaliesTest.phptests\Feature\AuthEventDetailTest.phptests\Feature\AuthEventsExplorerTest.phptests\Feature\ChannelsProvidersTest.phptests\Feature\ComplianceMeSettingsTest.phptests\Feature\FunnelsTest.phptests\Feature\MetricsProjectorTest.phptests\Feature\OverviewTest.phptests\Feature\RiskRulesTest.phptests\Feature\SubjectsTest.phptests\Pest.phptests\TestCase.php
Do not copy internal test-only classes into an application. Treat file lists as a source map for maintainers and auditors, not as an installation recipe by themselves.