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

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

vectorface/auth
===============

Simple Authentication framework

v0.3.1(1y ago)515.4k↓58%4MITPHPPHP &gt;=8.0CI failing

Since Jan 10Pushed 1y ago8 watchersCompare

[ Source](https://github.com/Vectorface/auth)[ Packagist](https://packagist.org/packages/vectorface/auth)[ Docs](https://github.com/Vectorface/auth)[ RSS](/packages/vectorface-auth/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (4)Versions (11)Used By (0)

Auth
====

[](#auth)

[![Build Status](https://camo.githubusercontent.com/731eb54adced3c44c211e6e8b02478b01c64aeee10df9cb6ad210811e36b5b84/68747470733a2f2f7472617669732d63692e6f72672f566563746f72666163652f617574682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Vectorface/auth)[![Code Coverage](https://camo.githubusercontent.com/52667166eb466aed016be1a50c3c15d07181e5139d695a433170cba9647a0d5f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f566563746f72666163652f617574682f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Vectorface/auth/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/2f22c6f2092044d471d4a002979e027794482afbf4fc265d6b2db8d03d0f2ea7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766563746f72666163652f617574682e737667)](https://packagist.org/packages/vectorface/auth)[![License: MIT](https://camo.githubusercontent.com/48612f1c68d16f086e06436c0d276eb1b22c96651f4c1ae34c80202c5c32a2bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f766563746f72666163652f617574682e737667)](https://opensource.org/licenses/MIT)

This is a simple authentication framework. It is intended to be used with a variety of interchangeable plugins which can perform authentication, handle sessions, and even authorization. Implementation of these are an exercise left up to others.

```
use Vectorface\Auth\Auth;
use Vectorface\Auth\Plugin\SuccessPlugin;

$auth = new Auth();
$auth->addPlugin(new SuccessPlugin());

if ($auth->login($_SERVER['PHP_AUTH_USER'] $_SERVER['PHP_AUTH_PW'])) {
	// Do super-secret ultra-dangerous things... SuccessPlugin allows everyone!
}
```

Something more useful
---------------------

[](#something-more-useful)

To do anything real with this, you need to implement your own authentication plugin. Maybe sprinkle in some other useful things like Authorization.

```
use Vectorface\Auth\Auth;
use Vectorface\Auth\Plugin\BaseAuthPlugin;

class MyAuthPlugin extends BaseAuthPlugin
{
	/**
	 * An array of user data. Pretend this is a database.
	 */
	private $users = [
		'root' => ['pass' => 'r00t', 'access' => '*'],
		'jdoe' => ['pass' => 'jdoe', 'access' => '']
	];

	/**
	 * Keep track of the currently logged in user.
	 *
	 * @var string
	 */
	private user;

	/**
	 * Compare credentials against our user "database".
	 */
	public function login($username, $password)
	{
		if (!isset($this->users[$username])) {
			return Auth::RESULT_FAILURE;
		}

		if ($this->users[$username]['pass'] !== $password) {
			return Auth::RESULT_FAILURE;
		}

		$this->user = $username;

		return Auth::RESULT_SUCCESS;
	}

	/**
	 * A *new* method. This will be exposed via the Auth object.
	 */
	public function hasAccess($resource)
	{
		if (isset($this->user)) {
			return $this->users[$this->user]['access'] === '*';
		}
		return false;
	}
}

$auth = new Auth();
$auth->addPlugin(new MyAuthPlugin());

if ($auth->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
	// You're in!
	if ($auth->hasAccess('some resource')) {
		// You're *really* in!
	}
}
```

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 85.1% 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 ~503 days

Recently: every ~394 days

Total

8

Last Release

711d ago

PHP version history (5 changes)v0.0.1PHP &gt;=5.3.0

v0.1.0PHP &gt;=5.4.0

v0.2.0PHP &gt;=7.0.0

v0.2.2PHP &gt;=7.3

v0.3.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/186284?v=4)[Janderson FFerreira](/maintainers/janderson)[@Janderson](https://github.com/Janderson)

![](https://avatars.githubusercontent.com/u/2111701?v=4)[Francis Lavoie](/maintainers/francislavoie)[@francislavoie](https://github.com/francislavoie)

---

Top Contributors

[![jdpanderson](https://avatars.githubusercontent.com/u/4468291?v=4)](https://github.com/jdpanderson "jdpanderson (40 commits)")[![francislavoie](https://avatars.githubusercontent.com/u/2111701?v=4)](https://github.com/francislavoie "francislavoie (4 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")[![nicolastuttle](https://avatars.githubusercontent.com/u/72220827?v=4)](https://github.com/nicolastuttle "nicolastuttle (1 commits)")

---

Tags

authAuthentication

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k302.1M240](/packages/google-auth)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

12514.0M163](/packages/web-auth-webauthn-lib)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.5M254](/packages/api-platform-metadata)[teresko/palladium

User authentication and registration component

4414.2k](/packages/teresko-palladium)

PHPackages © 2026

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