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)514.4k↓34.6%4MITPHPPHP &gt;=8.0

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 1mo 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

42

—

FairBetter than 90% of packages

Maintenance40

Moderate activity, may be stable

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

620d 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://www.gravatar.com/avatar/df4da5988e7543fce193f4554a6bb30fda64a716fb922cddd36612f82ab7e5a3?d=identicon)[janderson](/maintainers/janderson)

![](https://www.gravatar.com/avatar/7a6bd4b7a52a1ed056c6d597c4124a62da080137edd42cc34355ac2c28e4a154?d=identicon)[francislavoie](/maintainers/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

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40820.2M68](/packages/auth0-auth0-php)[kreait/firebase-tokens

A library to work with Firebase tokens

24040.8M14](/packages/kreait-firebase-tokens)

PHPackages © 2026

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