PHPackages                             glesys/butler-auth - 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. glesys/butler-auth

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

glesys/butler-auth
==================

v7.1.1(6mo ago)227.0k—5.6%21MITPHPPHP ^8.2CI passing

Since Feb 24Pushed 6mo ago11 watchersCompare

[ Source](https://github.com/glesys/butler-auth)[ Packagist](https://packagist.org/packages/glesys/butler-auth)[ RSS](/packages/glesys-butler-auth/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (9)Versions (22)Used By (1)

[![.github/workflows/test.yml](https://github.com/glesys/butler-auth/workflows/.github/workflows/test.yml/badge.svg)](https://github.com/glesys/butler-auth/workflows/.github/workflows/test.yml/badge.svg)

Butler Auth
===========

[](#butler-auth)

A minimal token authentication package inspired by [Laravel Sanctum](https://laravel.com/docs/8.x/sanctum).

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

[](#installation)

Requires a working Laravel app with a database connection, a queue worker and a cache store like redis or memcached.

```
composer require glesys/butler-auth

php artisan vendor:publish --tag=butler-auth-migrations
php artisan migrate
```

Generate token
--------------

[](#generate-token)

1. Implement `Butler\Auth\Models\Contracts\HasAccessTokens` on your consumer model.
2. Use `Butler\Auth\Models\Concerns\HasAccessTokens` on your consumer model.

```
$token = $consumer->createToken(abilities: ['*'], name: 'my token')->plainTextToken;
```

Deleting tokens
---------------

[](#deleting-tokens)

Because of the caching that occurres when fetching access tokens, it is important to delete tokens through the model and **not** in the database directly.

```
// Delete access token by ID
AccessToken::find($id)->delete();

// Delete all tokens for a consumer
$consumer->tokens->map->delete();
```

Protecting Routes
-----------------

[](#protecting-routes)

See [Laravels documentation](https://laravel.com/docs/8.x/authentication#protecting-routes).

```
// If "butler" is configured as your default guard
Route::view('/protected', 'protected')->middleware('auth');

// Or specify the guard
Route::view('/protected', 'protected')->middleware('auth:butler');
```

Authenticating
--------------

[](#authenticating)

Pass the token in the `Authorization` header as a `Bearer` token.

Testing
-------

[](#testing)

```
vendor/bin/phpunit
vendor/bin/pint --test
```

How To Contribute
-----------------

[](#how-to-contribute)

Development happens at GitHub; any typical workflow using Pull Requests are welcome. In the same spirit, we use the GitHub issue tracker for all reports (regardless of the nature of the report, feature request, bugs, etc.).

All changes are supposed to be covered by unit tests, if testing is impossible or very unpractical that warrants a discussion in the comments section of the pull request.

### Code standard

[](#code-standard)

As the library is intended for use in Laravel applications we encourage code standard to follow [upstream Laravel practices](https://laravel.com/docs/master/contributions#coding-style) - in short that would mean [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md).

###  Health Score

54

—

FairBetter than 96% of packages

Maintenance66

Regular maintenance activity

Popularity31

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 64.6% 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 ~167 days

Recently: every ~350 days

Total

18

Last Release

197d ago

Major Versions

v2.2.0 → v3.0.02020-12-09

v3.0.0 → v4.x-dev2021-05-28

v4.1.1 → v5.0.02022-02-14

v5.0.0 → v6.0.02023-03-02

v6.0.0 → v7.0.02024-05-29

PHP version history (8 changes)v1.0.0PHP ^7.1

v1.2.0PHP ^7.1.3

v1.4.0PHP ^7.2.5

v3.0.0PHP ^7.4|^8.0

v4.x-devPHP ^8.0

v5.0.0PHP ^8.0.2

v6.0.0PHP ^8.1

v7.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/708205?v=4)[Christoffer Andersson](/maintainers/wecc)[@wecc](https://github.com/wecc)

---

Top Contributors

[![ttrig](https://avatars.githubusercontent.com/u/2156132?v=4)](https://github.com/ttrig "ttrig (31 commits)")[![wecc](https://avatars.githubusercontent.com/u/708205?v=4)](https://github.com/wecc "wecc (16 commits)")[![brother](https://avatars.githubusercontent.com/u/243351?v=4)](https://github.com/brother "brother (1 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/glesys-butler-auth/health.svg)

```
[![Health](https://phpackages.com/badges/glesys-butler-auth/health.svg)](https://phpackages.com/packages/glesys-butler-auth)
```

###  Alternatives

[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k55.0M619](/packages/laravel-scout)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M208](/packages/illuminate-broadcasting)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[illuminate/notifications

The Illuminate Notifications package.

513.1M1.1k](/packages/illuminate-notifications)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)

PHPackages © 2026

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