Download the PHP package modularize-rbac/laravel without Composer

On this page you can find all versions of the php package modularize-rbac/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel

modularize-rbac/laravel

Laravel bridge for modularize-rbac/core. Ships Eloquent repositories, HTTP controllers, FormRequests, migrations, an audit log pipeline, console commands, and an optional Spatie permission adapter.

CI Packagist npm sdk-ts npm admin-react

What v2.0 ships

A drop-in admin RBAC layer with:

Architecture

Quickstart

From a fresh Laravel 11 / 12 host to a first authorized request in roughly five minutes.

1. Install

The seeder demonstrates the canonical flow (CreateModule → CreateRole → SyncRoleModules use-cases) and creates three modules + admin/viewer roles wired up correctly. Edit it to match your app, or read it as documentation and write your own.

2. Wire the User model

3. Seed a module, a role, and a binding

4. Use it

5. (Optional) Hit the admin API

The admin REST surface lives under config('access.route_prefix') (default api/admin). With a bearer token whose User has admin.modules.view:

That's the full path. The rest of this README is configuration knobs, the full REST table, and architecture details.

Install

Edit config/access.php and point tenant_model at your tenant class or leave null for single-tenant setups.

Host wiring

config/auth.php

Define the admin guard the package defaults to:

HasAccessPermissions on your User

Provides:

The AccessServiceProvider registers Gate::before so $user->can('events.view') works through Laravel's normal authorization flow.

Tenant context (optional)

Multi-tenant hosts bind the current tenant id in the container from their tenant-resolution middleware:

TenantContext::currentTenantId() reads this value. Single-tenant hosts never bind the key.

Spatie integration (optional)

spatie/laravel-permission is in suggest since v2.0. Install it alongside if you want role_has_permissions kept in sync (so Spatie's HasRoles trait keeps working on a different User model):

REST API

All routes under config('access.route_prefix') (default api/admin):

Method URL Action
GET /modules List modules
POST /modules Create
GET /modules/{id} Show
PUT /modules/{id} Update
DELETE /modules/{id} Soft delete
GET /roles List roles
GET /roles/{id} Show + matrix
PUT /roles/{id} Update display_name + translations
PUT /roles/{id}/modules Sync the role's permission matrix
GET /languages List
POST /languages Create
GET /languages/{id} Show
PUT /languages/{id} Update
DELETE /languages/{id} Delete (rejects default)
PUT /languages/{id}/default Mark as default
GET /audit List audit entries (?event=&actor_id=&tenant_id=&since=&until=&limit=&offset=)

Frontend & SDK

The bridge ships an openapi.json at the repo root that is the source of truth for two companion npm packages and a Postman collection.

TypeScript SDK — @modularize-rbac/sdk-ts

Spec-derived types + a thin openapi-fetch wrapper. Zero runtime cost when imported type-only.

Or use types only:

React admin components — @modularize-rbac/admin-react

Drop-in admin UI built on Radix Themes + React Query: <RolesPage />, <ModulesTreeEditor />, <LanguagesAdmin />, <AuditViewer />, <AccessGuard />. Each component renders against the same openapi.json so they always match the API the bridge exposes.

Storybook with mock data lives in frontend/ — every component has a story.

Postman collection

Regenerated from the same spec, committed at postman.json. Drag it into Postman or Insomnia to get all endpoints with example bodies. The sdk-ts-drift CI gate keeps both the TS types and the Postman collection in lockstep with openapi.json.

Console commands

Authorization model

Two layers:

  1. User layerGate::before (registered by the ServiceProvider) calls $user->canAccess($ability) when the User has the HasAccessPermissions trait. Resolves events.view-style abilities directly from role_user + role_module_permission + module_permissions.

  2. Admin layerAccessAdminPolicy (the default config('access.policies.admin')) wraps the same canAccess() check but scoped to admin.* abilities the package's use-cases consult (admin.modules.view, admin.audit.view, ...). Hosts override via config.

To grant admin.modules.view, create a module with slug admin.modules, bind it to a role with is_reading_allowed = true, and assign the role to the user via role_user.

Calling use-cases directly

Every use-case is container-resolvable:

Telemetry recipes

The package dispatches two Laravel events for hosts that want observability hooks without patching the bridge:

Listener exceptions are caught by the package, so a faulty telemetry listener can't break authorization or cache reads.

Sentry spans

Prometheus via spatie/laravel-prometheus

Structured JSON log (Logstash / OpenSearch)

Audit log failure level

The audit listener catches persistence failures (DB down, encoding quirk) so the main domain flow always completes. The level at which those failures land in the Laravel log is configurable:

Set to false to swallow the failure silently for hosts that already trap audit issues upstream.

Upgrading

Layout


All versions of laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.0|^12.0
modularize-rbac/core Version ^1.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package modularize-rbac/laravel contains the following files

Loading the files please wait ...