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

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

solution10/auth
===============

Powerful and extremely flexible authentication

v1.3.1(9y ago)121121[1 issues](https://github.com/Solution10/auth/issues)MITPHPPHP &gt;= 5.4

Since Jul 20Pushed 9y ago3 watchersCompare

[ Source](https://github.com/Solution10/auth)[ Packagist](https://packagist.org/packages/solution10/auth)[ RSS](/packages/solution10-auth/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (5)Versions (10)Used By (0)

Solution10\\Auth
================

[](#solution10auth)

Powerful and extremely flexible authentication

[![Build Status](https://camo.githubusercontent.com/83a33284f73ab338f467f5b1840996d719f13b6177f2d005c42975a2892f67e9/68747470733a2f2f7472617669732d63692e6f72672f536f6c7574696f6e31302f617574682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Solution10/auth)[![Coverage Status](https://camo.githubusercontent.com/cf77146fdba1df9990824b9672bc5bf1c8ac51745ec3624f4842b125da7bd46f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f536f6c7574696f6e31302f617574682f62616467652e706e67)](https://coveralls.io/r/Solution10/auth)[![Latest Stable Version](https://camo.githubusercontent.com/a24f01f7018c05305b18afc8068f89bfe0512fa490721da6f482f57ecd6086e1/68747470733a2f2f706f7365722e707567782e6f72672f536f6c7574696f6e31302f617574682f762f737461626c652e737667)](https://packagist.org/packages/Solution10/auth)[![Total Downloads](https://camo.githubusercontent.com/c8b8f95b1d81ce62bbc41c7ac019acc8c4274ad5ef1e1a63898df8fbe8a15030/68747470733a2f2f706f7365722e707567782e6f72672f536f6c7574696f6e31302f617574682f646f776e6c6f6164732e737667)](https://packagist.org/packages/Solution10/auth)[![License](https://camo.githubusercontent.com/a28e18bf862cc9db025c783a4b4a6a09afc66a7673c359b9e25353892b2ae685/68747470733a2f2f706f7365722e707567782e6f72672f536f6c7574696f6e31302f617574682f6c6963656e73652e737667)](https://packagist.org/packages/Solution10/auth)

Key Features
------------

[](#key-features)

- **Framework agnostic**: Can work with any framework and any ORM / database layer. Implement two classes to integrate with your tools of choice and Auth will do the rest.
    [Learn more about Integration](http://github.com/solution10/auth/wiki/Integrating)
- **Multiple Instances**: No statics or manky global scope. Every auth instance is totally self contained and can talk to entirely different backends and session handlers.
    [Learn more about Multiple Instances](http://github.com/solution10/auth/wiki/Instances)
- **Powerful Permissions**: Package based permissions allow you to define broad access control groups, and Overrides allow you to allow/disallow permissions on a per-user basis
    [Learn more about Permissions](http://github.com/solution10/auth/wiki/Permissions)

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

[](#installation)

Installation is as you'd expect, simply via a Composer requirement:

```
{
    "require": {
        "solution10/auth": "^1.2"
    }
}
```

**Note**: Auth provides absolutely no storage capability (no database layer / access). You will need to provide this by implementing a StorageDelegate. This approach might seem awkward at first, but it allows you to take completely control over the logic of data-retrieval, whilst Auth handles the actual mechanics for you. [Learn more about Integration](http://github.com/solution10/auth/wiki/Integrating)

Basic Usage
-----------

[](#basic-usage)

Your first step should be to complete everything in the [Integration guide](http://github.com/solution10/auth/wiki/Integrating), but that doesn't make for a sexy demo, so we'll assume you've done that!

Let's pretend that I have fully implemented a StorageDelegate called "PDOStorageDelegate".

```
// The storage delegate handles reading/writing User data from
// your data store. That could be a database, REST service, whatever.
$storageDelegate = new PDOStorageDelegate();

// The session delegate handles maintaining state between
// page loads. Essentially, it's a front to the $_SESSION array,
// but if you do it different, you can re-implement!
$sessionDelegate = new Solution10\Auth\Driver\Session();

// Fire up a new instance called "MyAuth"
$auth = new Solution10\Auth\Auth('MyAuth', $sessionDelegate, $storageDelegate);

// Play with some API methods:
if ($auth->loggedIn()) {
    echo 'Hi, '.$auth->user()->username.', welcome to the site!';
}
```

As you may have noticed, we give auth instances names. This gives us a way of referencing them later. More on that in the [Instances](http://github.com/solution10/auth/wiki/Instances) chapter.

### Logging In

[](#logging-in)

```
if ($auth->login($username, $password)) {
    echo 'User was logged in!';
} else {
    echo 'Please check your username and password.';
}
```

### Logging Out

[](#logging-out)

```
$auth->logout();
```

### Checking Login State

[](#checking-login-state)

```
if ($auth->loggedIn())) {
    echo "You're logged in!";
} else {
    echo "You are not logged in :(";
}
```

### Getting the Current User

[](#getting-the-current-user)

```
$user = $auth->user();
```

### Forcing a Login

[](#forcing-a-login)

This should be used with extreme caution, it will allow you to log a user in without their password. Probably only useful after registration.

```
// The $user object needs to be a class that implements the
// Solution10\Auth\UserRepresentation interface.
// It's a tiny interface, but it just gives us enough info to
// do our work.

$user = new UserRepresentationInstance();

$user->forceLogin($user);
```

You can read more about UserRepresentation in the [Integration guide](http://github.com/solution10/auth/wiki/Integrating)

PHP Requirements
----------------

[](#php-requirements)

- PHP &gt;= 5.4

Documentation
-------------

[](#documentation)

For a user guide: [Check out the Wiki here on GitHub](http://github.com/solution10/auth/wiki).

Author
------

[](#author)

Alex Gisby: [GitHub](http://github.com/alexgisby), [Twitter](http://twitter.com/alexgisby)

License
-------

[](#license)

[MIT](http://github.com/solution10/auth/tree/master/LICENSE.md)

Contributing
------------

[](#contributing)

[Contributors Notes](http://github.com/solution10/auth/tree/master/CONTRIBUTING.md)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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 ~164 days

Recently: every ~218 days

Total

7

Last Release

3336d ago

PHP version history (2 changes)v1.0.0PHP &gt;= 5.3.7

v1.2.0PHP &gt;= 5.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/231595?v=4)[Alex Gisby](/maintainers/alexgisby)[@alexgisby](https://github.com/alexgisby)

---

Top Contributors

[![alexgisby](https://avatars.githubusercontent.com/u/231595?v=4)](https://github.com/alexgisby "alexgisby (25 commits)")[![michaelspiss](https://avatars.githubusercontent.com/u/17252710?v=4)](https://github.com/michaelspiss "michaelspiss (1 commits)")

---

Tags

access-controlauthenticationcomposer-packagesphpauthAuthenticationaclcomponentaccess-control

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136387.1k](/packages/pktharindu-nova-permissions)[silvanite/novatoolpermissions

Laravel Nova Permissions (Roles and Permission based Access Control (ACL))

100256.7k2](/packages/silvanite-novatoolpermissions)[hosseinhezami/laravel-permission-manager

Advanced permission manager for Laravel.

403.3k](/packages/hosseinhezami-laravel-permission-manager)

PHPackages © 2026

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