Download the PHP package gusmanwidodo/auth-kit-permissions without Composer

On this page you can find all versions of the php package gusmanwidodo/auth-kit-permissions. 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 auth-kit-permissions

Auth-Kit Permissions

High-performance roles & permissions plugin for Auth-Kit. A hybrid access-control model — static roles (in-memory, zero-query) + dynamic roles (database) — with polymorphic scoping that is ready for the upcoming auth-kit-organization plugin.

Tests

Why another permissions package?

spatie/laravel-permission is excellent and battle-tested, but every permission check ultimately resolves against the database (mitigated by a global cache). For the overwhelmingly common case — a role defined at deploy time — that work is avoidable. Auth-Kit Permissions answers those checks in memory, with zero queries, and only touches the database for genuinely dynamic, runtime-defined roles (which it resolves in a single, memoized query).

The model mirrors better-auth's Access Control: a statement (resource => actions) → roles (subsets of the statement) → checks.

Benchmark

Real micro-benchmark (same process, same in-memory SQLite, spatie cache warm, 30,000 iterations, PHP 8.3). Reproduce with composer bench.

Scenario checks/sec ns/check
Ours — static role check (config) ~2,582,000 ~387
Spatie — hasPermissionTo (cache warm) ~39,800 ~25,115
Ours — dynamic check (memoized, in-request) ~2,188,000 ~457

→ ~65× faster than spatie on the common (static-role) check. Absolute numbers vary by machine; the ratio and the query count are the point:

These are asserted in the test suite, not just claimed.

Requirements

Installation

Defining static roles (the fast path)

In config/auth-kit-permissions.php, declare a statement and roles:

Roles can only grant actions declared in the statement — typos throw at boot, so you never silently deny in production.

Checking permissions

Or use the HasRoles trait on your User model:

HTTP endpoint

Mirrors better-auth's hasPermission:

Method URI Body Returns
POST /auth-kit/permissions/check { subject_type, subject_id, ability, static_roles?, scope_type?, scope_id? } { allowed: bool }

Dynamic roles

Runtime-defined roles live in the database and are managed via RoleService:

Scoping & organization compatibility

Every assignment and check carries an optional polymorphic scope (scope_type + scope_id). null = global.

This is the bridge to the planned auth-kit-organization plugin. When it ships, it will simply:

  1. build scopes with Scope::for('organization', $org->id),
  2. create/assign roles within that scope via RoleService,
  3. check with PermissionManager::check(..., scope: $orgScope).

No schema change, no API change — the scope column and the resolver already understand organization (and team/project) scopes today. Scope isolation is enforced (a global assignment never leaks into a scoped check, and vice versa) and covered by tests.

Extending via the hook pipeline

Every check runs the core before:permission.check hook, so other plugins can observe or veto:

Developing against a local core

License

MIT © Gusman Widodo. See LICENSE.


All versions of auth-kit-permissions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
gusmanwidodo/auth-kit Version ^0.1
illuminate/contracts Version ^12.0
illuminate/database Version ^12.0
illuminate/support Version ^12.0
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 gusmanwidodo/auth-kit-permissions contains the following files

Loading the files please wait ...