PHPackages                             webiik/privileges - 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. webiik/privileges

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

webiik/privileges
=================

The Privileges class manages user authorization.

1.0(7y ago)03MITPHPPHP &gt;=7.2

Since Mar 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/webiik/privileges)[ Packagist](https://packagist.org/packages/webiik/privileges)[ Docs](https://www.webiik.com)[ RSS](/packages/webiik-privileges/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![](https://camo.githubusercontent.com/a397347ee4fb199934fee6354504f4702b89f5c22f0ce0ba94c5ff691cde545c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656269696b2f77656269696b2e737667)](https://camo.githubusercontent.com/a397347ee4fb199934fee6354504f4702b89f5c22f0ce0ba94c5ff691cde545c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656269696b2f77656269696b2e737667)[![](https://camo.githubusercontent.com/20f4b99a958aadb02ff273ac6428c17cf55c6b817657ed64b1c39c7f71955a0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e2e737667)](https://camo.githubusercontent.com/20f4b99a958aadb02ff273ac6428c17cf55c6b817657ed64b1c39c7f71955a0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e2e737667)

Privileges
==========

[](#privileges)

The Privileges class manages user authorization.

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

[](#installation)

```
composer require webiik/privileges
```

Example
-------

[](#example)

```
$privileges = new \Webiik\Privileges\Privileges();

// Add roles
$privileges->addRole('user');
$privileges->addRole('admin');

// Add resources
$privileges->addResource('article', ['create', 'read', 'update', 'delete']);

// Allow access to resources
$privileges->allow('user', 'article', ['read']);
$privileges->allow('admin', 'article', ['all']);

// Test access to resources
if ($privileges->isAllowed('admin', 'article', 'update')) {
    // Admin can update an article
}
```

Adding Roles and Resources
--------------------------

[](#adding-roles-and-resources)

### addRole

[](#addrole)

```
addRole(string $role): void
```

**addRole()** adds user **role**.

```
$privileges->addRole('user');
```

### addResource

[](#addresource)

```
addResource(string $resource, array $privileges): void
```

**addResource()** adds **resource** and supported resource **privileges**. Never set privilege 'all', resource will be not added.

```
$privileges->addResource('article', ['create', 'read', 'update', 'delete']);
```

Allowing Access to Resources
----------------------------

[](#allowing-access-to-resources)

### allow

[](#allow)

```
allow(string $role, string $resource, array $privileges): void
```

**allow()** allows **role** access to the **resource** with given **privileges**. If role, resource or one of privileges doesn't exist, rule will be not added. If you want to grant all privileges, set **privileges** to **\['all'\]**.

```
$privileges->allow('user', 'article', ['read']);
```

Checking Access to Resources
----------------------------

[](#checking-access-to-resources)

### isAllowed

[](#isallowed)

```
isAllowed(string $role, string $resource, string $privilege): bool
```

**isAllowed()** checks if user with **role** can do **privilege** on **resource**.

```
if ($privileges->isAllowed('user', 'article', 'read')) {
    // User can read an article
}
```

Resources
---------

[](#resources)

- [Webiik framework](https://github.com/webiik/webiik)
- [Report issue](https://github.com/webiik/components/issues)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

2604d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1226362d003d186b45e7dfa44489c36af37196c6a1b476206700eaf4e9c96a5a?d=identicon)[Jiri Mihal](/maintainers/Jiri%20Mihal)

---

Top Contributors

[![Jiri-Mihal](https://avatars.githubusercontent.com/u/10408123?v=4)](https://github.com/Jiri-Mihal "Jiri-Mihal (2 commits)")

---

Tags

authorizationaclprivileges

### Embed Badge

![Health badge](/badges/webiik-privileges/health.svg)

```
[![Health](https://phpackages.com/badges/webiik-privileges/health.svg)](https://phpackages.com/packages/webiik-privileges)
```

###  Alternatives

[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.4M43](/packages/santigarcor-laratrust)[casbin/casbin

a powerful and efficient open-source access control library for php projects.

1.3k1.4M54](/packages/casbin-casbin)[nette/security

🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (Access Control List)

3839.3M279](/packages/nette-security)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6712.1k2](/packages/hasinhayder-tyro)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

324339.9k4](/packages/casbin-laravel-authz)[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136387.1k](/packages/pktharindu-nova-permissions)

PHPackages © 2026

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