PHPackages                             smartfactory/oauth2 - 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. smartfactory/oauth2

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

smartfactory/oauth2
===================

Implementation of the OAuth2 and JWT.

1.2.25(5mo ago)0296MITPHPPHP &gt;=8.4

Since Dec 21Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/oschildt/SmartFactoryOAuth2)[ Packagist](https://packagist.org/packages/smartfactory/oauth2)[ RSS](/packages/smartfactory-oauth2/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (1)Versions (36)Used By (0)

SmartFactory OAuth2 Server
--------------------------

[](#smartfactory-oauth2-server)

- Lightweight simple and flexible OAuth2 Server
- With support of the JSON Web Token
- Customizable user authentication and storage of the token records
- Designed based on IoC

For more details see [Presentation](http://php-smart-factory.org/oauth2_presentation.pdf) and [OAuth2 API documentation](http://php-smart-factory.org/oauth2/).

### Requirements

[](#requirements)

- PHP 8.4+

### Installation

[](#installation)

```
composer require "smartfactory/oauth2"

```

**composer.json**

```
{
  ...

  "require": {
    "php": ">=8.4",
    "smartfactory/smartfactory": ">=2.1.24",
    "smartfactory/oauth2": ">=1.2.24"
  }

  ...
}

```

### To get familiar with the SmartFactory Core and OAuth2 Server do the following:

[](#to-get-familiar-with-the-smartfactory-core-and-oauth2-server-do-the-following)

- Git-clone the demo application [SmartFactoryDemo](https://github.com/oschildt/SmartFactoryDemo) and run 'composer update'.
- Use the script *database/create\_database\_mysql.sql* (*create\_database\_mssql.sql*) to create a demo database necessary for some examples.
- View and study the API documentation in the folder docs or here [OAuth2 API documentation](http://php-smart-factory.org/oauth2/).
- Study the core code of the library SmartFactory and SmartFactory OAuth2 Server.
- The example *18.oauth.php* demonstrates usage of the SmartFactory OAuth2 Server.

### To start writing own application using SmartFactory OAuth2 Server

[](#to-start-writing-own-application-using-smartfactory-oauth2-server)

1. Git-clone the demo application [SmartFactoryDemo](https://github.com/oschildt/SmartFactoryDemo) and run 'composer update'.
2. Study the directory structure of the demo application and the code.
3. Implement the interfaces IUserAuthenticator and IUserAuthenticator.
4. Bind you classes to the interfaces in the file *initialization\_inc.php* to be able to use the IoC approach for creating objects offered by the library SmartFactory.
5. Implement the JSON API request handlers.
6. Add translation texts for your application over the *localization/edit.php* or directly into the JSON file *localization/texts.json*. Use the script *localization/check.php* to check your translations for missing translations.

Directory Structure
-------------------

[](#directory-structure)

```
docs
src
  OAuth2
    Interfaces

```

Detailed description
--------------------

[](#detailed-description)

### docs

[](#docs)

This directory contains the documentation about classes, interfaces and functions of the SmartFactory OAuth2 Server.

### src

[](#src)

This is the root directory for all classes and interfaces. The class loader is implemented based on PSR4 approach. You have no need to add additional class loader function.

### src/OAuth2

[](#srcoauth2)

This directory contains the core classes and interfaces of the SmartFactory OAuth2 Server.

### src/OAuth2/Interfaces

[](#srcoauth2interfaces)

This directory contains the core interfaces of the SmartFactory OAuth2 Server.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance70

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

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

Recently: every ~171 days

Total

35

Last Release

170d ago

PHP version history (3 changes)1.1.1PHP &gt;=7.2.0

1.2.16PHP &gt;=8.0

1.2.24PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/60dcf712e8e2ffb570e4bf3aec1ac9369e7aaa9690c900bfccc04c54b3f48bab?d=identicon)[oschildt](/maintainers/oschildt)

---

Top Contributors

[![oschildt](https://avatars.githubusercontent.com/u/4179648?v=4)](https://github.com/oschildt "oschildt (60 commits)")

---

Tags

jwtlibraryoauth2

### Embed Badge

![Health badge](/badges/smartfactory-oauth2/health.svg)

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

###  Alternatives

[league/openid-connect-claims

An OpenID Connect ID claims set implementation

15242.9k2](/packages/league-openid-connect-claims)[jakub-onderka/openid-connect-php

Bare-bones OpenID Connect client

1151.4k](/packages/jakub-onderka-openid-connect-php)

PHPackages © 2026

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