PHPackages                             dotkernel/dot-authorization - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. dotkernel/dot-authorization

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

dotkernel/dot-authorization
===========================

Dotkernel authorization service abstractions

3.8.1(3mo ago)630.6k↑234.1%37MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Mar 7Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/dotkernel/dot-authorization)[ Packagist](https://packagist.org/packages/dotkernel/dot-authorization)[ Docs](https://github.com/dotkernel/dot-authorization)[ RSS](/packages/dotkernel-dot-authorization/feed)WikiDiscussions 3.0 Synced 1mo ago

READMEChangelog (10)DependenciesVersions (23)Used By (7)

dot-authorization
=================

[](#dot-authorization)

Dotkernel authorization service abstractions.

`dot-authorization` is Dotkernel's authorization base package that defines interfaces for authorization services to be used with Dotkernel applications.

Documentation
-------------

[](#documentation)

Documentation is available at: .

Badges
------

[](#badges)

[![OSS Lifecycle](https://camo.githubusercontent.com/2d9bf9192ed5ef1c9a1b7d4892d1da600a26155112126b40c01f8d33f456603e/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d617574686f72697a6174696f6e)](https://camo.githubusercontent.com/2d9bf9192ed5ef1c9a1b7d4892d1da600a26155112126b40c01f8d33f456603e/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d617574686f72697a6174696f6e)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/6bd5fee2ab6668f66bd5164bb62083f91b1666e4767072273816a21c7b4619f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d617574686f72697a6174696f6e2f332e382e30)](https://camo.githubusercontent.com/6bd5fee2ab6668f66bd5164bb62083f91b1666e4767072273816a21c7b4619f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d617574686f72697a6174696f6e2f332e382e30)

[![GitHub issues](https://camo.githubusercontent.com/17a8699b36a01b8a4062e4508515bf960fdf54ae77fde51f514d2c6a7e47edbd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f646f746b65726e656c2f646f742d617574686f72697a6174696f6e)](https://github.com/dotkernel/dot-authorization/issues)[![GitHub forks](https://camo.githubusercontent.com/c59821fef7f45f893457ac5ca29d7edf9ab7c5115415a6c20dfc84335a5ac1f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f646f746b65726e656c2f646f742d617574686f72697a6174696f6e)](https://github.com/dotkernel/dot-authorization/network)[![GitHub stars](https://camo.githubusercontent.com/c3b617a09e4a59729575622c9bd12eae348557a0ac1f7d86048208fd15018614/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f646f746b65726e656c2f646f742d617574686f72697a6174696f6e)](https://github.com/dotkernel/dot-authorization/stargazers)[![GitHub license](https://camo.githubusercontent.com/0dbee81aefb4f425aa37b231792f728c2bab05029264212969a93cdc2846146e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646f746b65726e656c2f646f742d617574686f72697a6174696f6e)](https://github.com/dotkernel/dot-authorization/blob/3.0/LICENSE.md)

[![Build Static](https://github.com/dotkernel/dot-authorization/actions/workflows/continuous-integration.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-authorization/actions/workflows/continuous-integration.yml)[![codecov](https://camo.githubusercontent.com/fa8f002bf5fa3db3b2027a975cd97b83d1133c99df78c369d778c954e61dd6cd/68747470733a2f2f636f6465636f762e696f2f67682f646f746b65726e656c2f646f742d617574686f72697a6174696f6e2f67726170682f62616467652e7376673f746f6b656e3d5a425a444541334c5938)](https://codecov.io/gh/dotkernel/dot-authorization)[![PHPStan](https://github.com/dotkernel/dot-authorization/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-authorization/actions/workflows/static-analysis.yml)

Installation
------------

[](#installation)

Run the following command in your project directory:

```
composer require dotkernel/dot-authorization
```

Please note that usually this package will be installed as a dependency to a concrete implementation, so you won't need to add this to your project manually.

AuthorizationInterface
----------------------

[](#authorizationinterface)

Defines the interface that should be implemented by any authorization service to work with Dotkernel applications. This is a result of the fact that, by default, any Dotkernel package which has to do with authorization is assuming that a service is registered in the service container using as service name this interface's FQN.

### Methods

[](#methods)

```
public function isGranted(string $permission, array $roles = [], $context = null): bool;
```

> This is the only method that deals with authorization.

Given a permission and a list of roles, should return a boolean value of true if at least one role has access to the requested permission. As you can see, we expect that the authorization service to be implemented as a RBAC.

RoleInterface
-------------

[](#roleinterface)

Defines the interface that Role objects must implement. A role object should be able to retrieve its name, so this interface has only one method defined.

```
public function getName(): string;
```

IdentityInterface
-----------------

[](#identityinterface)

Interface that needs to be implemented by entities that support roles. They should be able to retrieve their roles by defining a `getRoles()` method. The roles should be an array of role names or role objects.

This package is suitable for RBAC style authorization. Roles can be flat or hierarchical, and they are assigned permissions. A role is granted if it has the required permission.

ForbiddenException
------------------

[](#forbiddenexception)

Exception to be thrown when accessing content without having the required permissions. This can be used withing an application to trigger a forbidden error and do a custom action (like displaying a forbidden page or redirecting). This package does not define how you should handle such situations. There is a concrete authorization implementation in [dot-rbac](https://github.com/dotkernel/dot-rbac) and a forbidden exception handler in [dot-rbac-guard](https://github.com/dotkernel/dot-rbac-guard) as Dotkernel default packages for authorization.

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance79

Regular maintenance activity

Popularity35

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~154 days

Recently: every ~91 days

Total

22

Last Release

110d ago

Major Versions

v0.1.2 → v2.0.02020-01-30

2.0.x-dev → 3.0.02020-04-22

PHP version history (8 changes)0.1.0PHP ^7.1

v2.0.0PHP ^7.2

3.0.0PHP ^7.4

3.2.0PHP ^7.4 || ~8.0.0 || ~8.1.0

3.4.0PHP ~8.1.0 || ~8.2.0

3.4.1PHP ~8.1.0 || ~8.2.0 || ~8.3.0

3.6.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

3.8.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1156873?v=4)[Dotkernel](/maintainers/dotkernel)[@dotkernel](https://github.com/dotkernel)

---

Top Contributors

[![alexmerlin](https://avatars.githubusercontent.com/u/4542449?v=4)](https://github.com/alexmerlin "alexmerlin (16 commits)")[![n3vrax](https://avatars.githubusercontent.com/u/5805542?v=4)](https://github.com/n3vrax "n3vrax (12 commits)")[![poprazvan17](https://avatars.githubusercontent.com/u/138594452?v=4)](https://github.com/poprazvan17 "poprazvan17 (9 commits)")[![arhimede](https://avatars.githubusercontent.com/u/22009710?v=4)](https://github.com/arhimede "arhimede (8 commits)")[![claurospace](https://avatars.githubusercontent.com/u/224870609?v=4)](https://github.com/claurospace "claurospace (4 commits)")[![gabidj](https://avatars.githubusercontent.com/u/3998573?v=4)](https://github.com/gabidj "gabidj (4 commits)")[![SergiuBota1](https://avatars.githubusercontent.com/u/50962867?v=4)](https://github.com/SergiuBota1 "SergiuBota1 (1 commits)")[![Howriq](https://avatars.githubusercontent.com/u/63609103?v=4)](https://github.com/Howriq "Howriq (1 commits)")

---

Tags

laminasauthorizationlaminas-dependency

### Embed Badge

![Health badge](/badges/dotkernel-dot-authorization/health.svg)

```
[![Health](https://phpackages.com/badges/dotkernel-dot-authorization/health.svg)](https://phpackages.com/packages/dotkernel-dot-authorization)
```

###  Alternatives

[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[league/oauth2-client

OAuth 2.0 Client Library

3.8k118.6M1.2k](/packages/league-oauth2-client)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40820.2M68](/packages/auth0-auth0-php)[laminas/laminas-permissions-rbac

Provides a role-based access control management

353.4M29](/packages/laminas-laminas-permissions-rbac)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
