PHPackages                             decodelabs/disciple - 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. decodelabs/disciple

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

decodelabs/disciple
===================

Take control of your users

v0.6.1(8mo ago)31.3k1MITPHPPHP ^8.4CI passing

Since Apr 20Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/decodelabs/disciple)[ Packagist](https://packagist.org/packages/decodelabs/disciple)[ RSS](/packages/decodelabs-disciple/feed)WikiDiscussions develop Synced 5d ago

READMEChangelog (10)Dependencies (5)Versions (25)Used By (1)

Disciple
========

[](#disciple)

[![PHP from Packagist](https://camo.githubusercontent.com/9815c1917bc336d75273a0ccdc3f4dfe85c69b9962b95e5d573aaadaf035fcfd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6465636f64656c6162732f6469736369706c653f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/disciple)[![Latest Version](https://camo.githubusercontent.com/7d3ce01414b15d270198c6b38605362f63f74be4b4f54c5b77a7dae73cbba7f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465636f64656c6162732f6469736369706c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/disciple)[![Total Downloads](https://camo.githubusercontent.com/6229e8bd2b7d9ebf951b7b67888a62ba7d19b78d6c50be0f0d26a68350104f95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465636f64656c6162732f6469736369706c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/disciple)[![GitHub Workflow Status](https://camo.githubusercontent.com/e00ab8ad29bb5280c18fe3c462a254ccbb718428cc136b668f1344595cd08bb2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6465636f64656c6162732f6469736369706c652f696e746567726174652e796d6c3f6272616e63683d646576656c6f70)](https://github.com/decodelabs/disciple/actions/workflows/integrate.yml)[![PHPStan](https://camo.githubusercontent.com/e25c14ce011edabdd0fbd2e10415b41cc5d66ed11ef3e5b7edd074c5bdd35a2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d3434434331312e7376673f6c6f6e6743616368653d74727565267374796c653d666c6174)](https://github.com/phpstan/phpstan)[![License](https://camo.githubusercontent.com/0ebb2a2df4271ab71edfc47c81ddcc944158abc9e9249321e4578c214c6312f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465636f64656c6162732f6469736369706c653f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/disciple)

### Take control of your users

[](#take-control-of-your-users)

Disciple offers a set of simple interfaces that allows third party code to define reliable entry points to user state and data.

---

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

[](#installation)

This package requires PHP 8.4 or higher.

Install via Composer:

```
composer require decodelabs/disciple
```

Usage
-----

[](#usage)

### Implementation

[](#implementation)

An implementation of Disciple revolves around an Adapter - this acts as the primary mediator between the Disciple service and your system's user management infrastructure.

```
namespace DecodeLabs\Disciple;

interface Adapter
{
    public ?string $identity { get; }
    public Profile $profile { get; }
    public Client $client { get; }

    public bool $loggedIn { get; }

    public function isA(
        string ...$signifiers
    ): bool;
}
```

Your adapter should be supplied during instantiation of the Disciple service. This is typically done in your app's bootstrap process via your service container:

```
use DecodeLabs\Disciple;
use DecodeLabs\Disciple\Adapter;
use DecodeLabs\Monarch;
use My\App\DiscipleAdapter;

Monarch::getKingdom()->container->set(
    Adapter::class,
    new DiscipleAdapter($myUserManager)
);

$disciple = Monarch::getService(Disciple::class);
```

Then at any future point, queries can be made against the current user:

```
if($disciple->loggedIn) {
    echo 'Yay, you\'re logged in';
} else {
    echo 'Boo, nobody loves me';
}
```

### Profile

[](#profile)

A registered Adapter should be able to provide an instance of a `Profile`, representing core data about the current user, such as name, email address, locale, etc.

```
interface Profile
{
    public ?string $id { get; }
    public ?string $email { get; }
    public ?string $fullName { get; }
    public ?string $firstName { get; }
    public ?string $surname { get; }
    public ?string $nickName { get; }

    public ?DateTime $registrationDate { get; }
    public ?DateTime $lastLoginDate { get; }

    public ?string $language { get; }
    public ?string $country { get; }
    public ?string $timeZone { get; }

    /**
     * @var list
     */
    public array $signifiers { get; }
}
```

The service can interface directly with this profile information, allowing quick access of user data:

```
if($disciple->loggedIn) {
    echo 'Hello ' . $disciple->fullName;
} else {
    echo 'You should probably log in first';
}
```

### Client

[](#client)

An Adapter should also be able to provide a Client object which can report details of how a user is interfacing with the system.

Currently, that entails the following, but with more to follow in future versions:

```
interface Client
{
    public string $protocol { get; }
    public Ip $ip { get; }
    public string $ipString { get; }
    public ?string $agent { get; }
}
```

### Signifiers

[](#signifiers)

The Disciple interfaces define the concept of `signifiers` - string keys that users can be categorised and identified by.

It is the responsibility of the Adapter implementation to define *how* signifiers are stored and distributed, however the definition of this interface allows for a powerful, quick access mechanism for high level structures in your application.

```
if($disciple->isA('admin')) {
    echo 'You can see the fun stuff';
} else {
    echo 'You should go home now';
}
```

Licensing
---------

[](#licensing)

Disciple is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance67

Regular maintenance activity

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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 ~72 days

Recently: every ~51 days

Total

23

Last Release

249d ago

PHP version history (4 changes)v0.1.0PHP ^7.2|^8.0

v0.3.0PHP ^8.0

v0.4.0PHP ^8.1

v0.5.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a241d64d12b3b5ee94197862ec1ec30b82ed2efa34a0cd7f4c3565a021daddd?d=identicon)[betterthanclay](/maintainers/betterthanclay)

---

Top Contributors

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

---

Tags

phpuseruser-managementclientuser

### Embed Badge

![Health badge](/badges/decodelabs-disciple/health.svg)

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

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[org_heigl/hybridauth

Lightweight Authentication Module for Zend-Framework 2 using the hybridauth-library

211.9k](/packages/org-heigl-hybridauth)

PHPackages © 2026

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