tallieutallieu / dry-accounts
There is no license information available for the latest version (3.0.3) of this package.
Account system for DRY applications
3.0.3
2025-09-17 13:19 UTC
Requires
- lindelius/php-jwt: ^0.9.1
- tallieutallieu/dry: ^v3.3.0-beta.18
- tallieutallieu/dry-dbi: ^3.0.0
- tallieutallieu/dry-external-api: ^3.0.0
- tallieutallieu/oak: ^3.0.2
- dev-master
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.20
- 2.0.19
- 2.0.18
- 2.0.17
- 2.0.16
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-dry3
- dev-feature/add-use-legacy-hash
- dev-fix/wrong-fetchexception-import
- dev-feature/add-resend-activated-event
This package is auto-updated.
Last update: 2025-09-17 13:20:55 UTC
README
Account system for DRY applications
Installation
composer require tallieutallieu/dry-accounts
php oak migration migrate -m accounts
Config options
Name | Type | Default |
---|---|---|
model | dry\orm\Model | Tnt\Account\Model\User |
storage | UserStorageInterface | SessionUserStorage |
factory | UserFactoryInterface | UserFactory |
repository | UserRepositoryInterface | UserRepository |
Basic example usage
Usage
<?php namespace controller; class authentication { public static function login(Request $request) { $login_form = new Form( $request); $login_form->add_email( 'email', [ 'required' => true ] ); $login_form->add_password( 'password', [ 'required' => true ] ); $auth_failed = false; $is_logged_in = \Tnt\Account\Facade\Auth::isAuthenticated(); if( $login_form->validate() ) { if( \Tnt\Account\Facade\Auth::authenticate( $login_form->get( 'email' ), $login_form->get( 'password' ) ) ) { $is_logged_in = true; } else { $auth_failed = true; } } $tpl = new Template(); $tpl->login_form = $login_form; $tpl->auth_failed = $auth_failed; $tpl->is_logged_in = $is_logged_in; $tpl->render('users/login.tpl'); } public static function register(Request $request) { $app = Application::get(); $register_form = new Form( $request); $register_failed = false; $register_form->add_email('email', [ 'required' => true, 'extra_validation' => function( $value, &$errors ) use ( &$register_failed, $app ) { if ($app->get(AuthenticationInterface::class)->getActivatedUser($value)) { $errors[] = 'user_already_activated'; $register_failed = true; } } ]); $register_form->add_password( 'password', ['required' => true,] ); if( $register_form->validate() ) { $user = $app->get(AuthenticationInterface::class) ->register( $register_form->get('email'), $register_form->get('password') ); echo 'User registered ' . $user->email; } $tpl = new Template(); $tpl->register_form = $register_form; $tpl->register_failed = $register_failed; $tpl->render('users/register.tpl'); } public static function logout(Request $request) { \Tnt\Account\Facade\Auth::logout(); Response::redirect('login/'); } }