-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
| PHP |
^8.0 (tested through 8.4) |
| Extensions |
ext-json, ext-hash (bundled with default PHP builds) |
| Runtime dependencies |
initphp/parameterbag ^2.0
|
Development dependencies (PHPUnit, PHPStan, PHP-CS-Fixer) live under
require-dev and are not installed when you depend on
initphp/auth from another project.
composer require initphp/authThe classes are autoloaded under the InitPHP\Auth namespace via PSR-4:
{
"autoload": {
"psr-4": {
"InitPHP\\Auth\\": "src/"
}
}
}Cookie-related types live in a sub-namespace:
InitPHP\Auth\Cookie\CookieWriterInterface
InitPHP\Auth\Cookie\NativeCookieWriter
InitPHP\Auth\Cookie\InMemoryCookieWriter
<?php
require __DIR__ . '/vendor/autoload.php';
use InitPHP\Auth\Permission;
$perm = new Permission(['Editor']);
var_dump($perm->is('editor')); // bool(true)If the autoloader cannot locate the class, double-check that you ran
composer install (or composer dump-autoload) and that your script
requires vendor/autoload.php before instantiating the type.
Every PR runs the test matrix against:
- PHP 8.0
- PHP 8.1
- PHP 8.2
- PHP 8.3
- PHP 8.4
The static analysis (PHPStan level 8) and code-style (PHP-CS-Fixer) jobs run against the highest supported version.
If you discover a regression on a supported version, please
file an issue and include
the PHP version reported by php -v.
If you run the test suite against a vanilla PHP CLI binary, the SAPI does
not seed session.save_path and session_start() will silently bail.
The package ships its own phpunit.xml.dist that sets a working path,
but if you wire up a custom one make sure to mirror these directives:
<php>
<ini name="session.save_handler" value="files"/>
<ini name="session.save_path" value="/tmp"/>
<ini name="output_buffering" value="4096"/>
</php>- Walk through the everyday API in Quick Start.
- See the full list of configuration knobs in Configuration.
- Upgrading from v1? Read the Migration Guide.
initphp/auth · MIT License · part of the InitPHP family
Source · Issues · Discussions · Packagist · Contributing · Security Policy
Getting Started
Core Types
Adapters
Reference
Recipes
Migration & Help