Polaris for PHP · 0.1.0

One library, every framework.

Self-hosted authentication in your database, with one core and an adapter per framework: Laravel, Symfony, Yii and PSR-15, on PostgreSQL, MySQL and SQLite. Every adapter serves the same 52 endpoints with the same responses.

$ composer require polaris/laravel
$ composer require polaris/symfony
$ composer require polaris/yii
$ composer require polaris/core polaris/psr15 polaris/pdo

Laravel · 13

polaris/laravel

php artisan polaris:install && php artisan migrate, then Route::middleware('auth:polaris').

/php/laravel examples/laravel

Symfony · 7.4 / 8

polaris/symfony

Register PolarisBundle, import the routes with type: polaris, put PolarisAuthenticator on a firewall.

/php/symfony examples/symfony

Yii · 3

polaris/yii

A yiisoft/config plugin: set the polaris params, and the routes and the polaris/authentication middleware are there.

/php/yii examples/yii

PSR-15 · Slim, Mezzio, any PSR-15 host

polaris/psr15

Polaris::create(new Config(...)), Pipeline::middleware(), Pipeline::handler().

/php/psr15 examples/slim

Adapter matrix

Frameworks and databases

Framework Package PostgreSQLMySQLSQLite
Laravel 13 polaris/laravel livelivelive
Symfony 7.4 / 8 polaris/symfony livelivelive
Yii 3 polaris/yii livelivelive
PSR-15 Slim, Mezzio, any PSR-15 host polaris/psr15 livelivelive
Univeros 2.5 univeros/polaris livelivelive

For Univeros users

univeros/polaris 2.0.0 is the same module rebuilt on polaris/core, a breaking major: Univeros\Polaris\* classes become the Polaris\* classes of the core, the database is not migrated from 1.x, and TOTP factors are re-enrolled. 1.x installations keep working on their own branch; upgrade when you can re-enrol MFA. Read the upgrade guide · Polaris for Univeros documentation

How it's proven

The same behaviour, replayed in CI.

52
endpoints
184
contract fixtures
1,201
request/response steps
35
events

The 184 contract fixtures, 1,201 request/response steps recorded from Polaris 1.0, replay in CI through PSR-15, Laravel, Symfony and Yii. The adapter conformance suite runs polaris/pdo on PostgreSQL, MySQL and SQLite and polaris/testing on its in-memory adapter. polaris/core imports no framework, enforced in CI.

The proof, in the adapter contract