PHPackages                             francerz/access-manager - 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. francerz/access-manager

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

francerz/access-manager
=======================

A PSR-15 based Access Manager handler.

v0.1.4(4mo ago)0368ISCPHP

Since May 8Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/francerz/php-access-manager)[ Packagist](https://packagist.org/packages/francerz/access-manager)[ RSS](/packages/francerz-access-manager/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (5)Versions (6)Used By (0)

Access Manager
==============

[](#access-manager)

The `francerz\access-manager` library provides a PSR-15 middleware class that manages access control to routes based on granted permissions.

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

[](#installation)

You can install the library via Composer. Run the following command:

```
composer require francerz/access-manager
```

Usage
-----

[](#usage)

### Using Slim Framework

[](#using-slim-framework)

1. Create an `UserGrantsProviderInterface` implementation to retrieve current user grants.

    ```
    use Francerz\AccessManager\UserGrantsProviderInterface;

    class CurrentUserGrantsProvider implements UserGrantsProviderInterface
    {
        public function getUserGrants(): string
        {
            // Returns the current user grants.
            return $_SESSION['user_grants'];
        }
    }
    ```
2. Configure the access middleware in your Slim\\App routing:

    ```
    use Francerz\AccessManager\AccessMiddleware;
    use Slim\Routing\RouteCollectorProxy;

    $app = new \Slim\App();

    // A PSR-17 ResponseFactory implemenation
    $responseFactory = new \GuzzleHttp\Psr7\HttpFactory();

    $userPermissionProvider = new CurrentUserGrantsProvider();
    $accessMiddleware = new AccessMiddleware($userPermissionProvider, $responseFactory);

    $app->get('[/]', [HomeController::class, 'indexGet'])
        ->addMiddleware($accessMiddleware->allow('user'));

    $app->group('/admin', function(RouteCollectorProxy $route) {
        // Restricted admin routes.
        $route->get('[/]', [AdminController::class, 'indexGet']);
    })->addMiddleware($accessMiddleware->allow('admin'));

    $app->get('/admin-or-user', [HomeController::class, 'indexGet'])
        ->addMiddleware($accesMiddleware->allow('admin', 'user'));

    $app->get('/admin-and-user', [HomeController::class, 'indexGet'])
        ->addMiddleware($access->allow(['admin', 'user']));
    ```

Permission Syntax
-----------------

[](#permission-syntax)

The `allow` method accept a permission string with a syntax similar to boolean logic:

- Use space to separate individual permissions; each space acts as an `AND`operator.
- Use character `|` to represent an `OR` operator, e.g., `'read | write'`.

License
-------

[](#license)

This library is licensed under the MIT License. see the [LICENSE](./LICENSE)file for details.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance77

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

Every ~162 days

Total

5

Last Release

127d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/630263d156ec44e1d55c3d237fe08354442d0cbe7b257032997d0a649baf1854?d=identicon)[francerz](/maintainers/francerz)

---

Top Contributors

[![francerz](https://avatars.githubusercontent.com/u/10836837?v=4)](https://github.com/francerz "francerz (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/francerz-access-manager/health.svg)

```
[![Health](https://phpackages.com/badges/francerz-access-manager/health.svg)](https://phpackages.com/packages/francerz-access-manager)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5733.2M40](/packages/thecodingmachine-graphqlite)[mezzio/mezzio

PSR-15 Middleware Microframework

3903.8M120](/packages/mezzio-mezzio)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

577.0M95](/packages/laminas-laminas-stratigility)

PHPackages © 2026

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