phroute / authentic
There is no license information available for the latest version (v0.9.0) of this package.
v0.9.0
2015-04-21 22:09 UTC
Requires
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.4
- satooshi/php-coveralls: dev-master
- symfony/http-foundation: ~2.6
Suggests
- symfony/http-foundation: Use Symfony Session and Cookie components for auth token persistence
This package is not auto-updated.
Last update: 2024-11-19 03:38:16 UTC
README
Authentic is a simple, framwork agnostic authentication library, designed to be flexible and easy to integrate with any PHP project.
use Phroute\Authentic\Authenticator; /** * Your application user repository * Implements: * public function findById($id); * public function findByLogin($login); * public function registerUser(array $userDetails); */ $userRepository = new UserRepository(); $auth = new Authenticator($userRepository);
use Phroute\Authentic\Exception\AuthenticationException; $credentials = array( 'email' => 'email@example.com', 'password' => 'pa55w0rd' ); $rememberMe = true; try { $auth->authenticate($credentials, $rememberMe); }catch(AuthenticationException $e) { return false; // Nope... } // Aaaaand we're in... return true;