PHPackages                             falco442/slim-multirole-authentication-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. falco442/slim-multirole-authentication-authorization

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

falco442/slim-multirole-authentication-authorization
====================================================

A basic http authentication/authorization middleware with multirole feature

00PHP

Since Nov 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/falco442/slim-multirole-authentication-authorization)[ Packagist](https://packagist.org/packages/falco442/slim-multirole-authentication-authorization)[ RSS](/packages/falco442-slim-multirole-authentication-authorization/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

slim-multirole-authentication-authorization
===========================================

[](#slim-multirole-authentication-authorization)

Introduction
------------

[](#introduction)

This Middleware is made for [Slim Skeleton Application](https://github.com/slimphp/Slim-Skeleton). It uses Eloquent for its functionalities, so you are supposed that you follow the Slim 3's guide chapter [Using Eloquent with Slim](https://www.slimframework.com/docs/v3/cookbook/database-eloquent.html) to use Slim with Eloquent, the *Laravel* ORM.

This middleware verifies the presence of the `Authorization` header as it's determined by the W3 convention, and blocks/allows the other requests.

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

[](#installation)

Get it with composer

```
composer require falco442/slim-multirole-authentication-authorization
```

Use
---

[](#use)

You can then bootstrap your app with your settings:

```
require 'vendor/autoload.php';

use falco442\Middleware\Authentication\BasicHttpAuthentication;

// Create and configure Slim app
$config = [
    'settings' => [
        'addContentLengthHeader' => false,
        'displayErrorDetails' => true,
        // other settings
        'authentication' => [
            'userModel' => 'your-eloquent-model-with-namespace', // for example 'App\\Model\\User'
            'fields' => [
                'username' => 'email',
                'password' => 'password'
            ],
            'jsonResponse' => true, // if you want response in json format
            'unauthorizedMessage' => 'Your unauthorized message',
            'unauthorizedStatus' => 403 // Usually 403
        ]
    ]
];
$app = new \Slim\App($config);

$capsule = new \Illuminate\Database\Capsule\Manager;
$capsule->addConnection($config['settings']['db']);

$capsule->setAsGlobal();
$capsule->bootEloquent();

$app->get('/',function($request, $response, $args){
    return $response->withJson([1,2,3]);
})->add((new BasicHttpAuthentication($app->getContainer())));

// Run app
$app->run();
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3620abbff28b3934d7ab220236a87b0e9317bdf2a94bbbed68b8ea633a7a417b?d=identicon)[falco442](/maintainers/falco442)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/falco442-slim-multirole-authentication-authorization/health.svg)

```
[![Health](https://phpackages.com/badges/falco442-slim-multirole-authentication-authorization/health.svg)](https://phpackages.com/packages/falco442-slim-multirole-authentication-authorization)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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