texdc / veritas
Identity and Access Control - Simplified, but not anemic
dev-develop
2017-03-31 19:46 UTC
Requires
- php: ~5.4 || ~7.0
Requires (Dev)
- phpmd/phpmd: @stable
- phpunit/phpunit: @stable
- satooshi/php-coveralls: @stable
- squizlabs/php_codesniffer: @stable
Suggests
- texdc/momento: Momento for domain events
- texdc/range: range for rich enablements
This package is not auto-updated.
Last update: 2024-12-21 16:15:27 UTC
README
Identity and Access Control - simplified, but not anemic.
WIP: currently experimental only
Passwords and Validation
use texdc\veritas\identity\CryptoServiceInterface; use texdc\veritas\identity\Password; class User { /** * @var Password */ private $password; // ... public function changePassword(string $aPassword, CryptoServiceInterface $aCryptoService) { $this->setPassword(new Password($aCryptoService->encrypt($aPassword))); $this->eventService->publish(new PasswordChangedEvent($this->userId)); } protected function setPassword(Password $aPassword) { if ($this->password == $aPassword) { throw new IdenticalPasswordException; } $this->password = $aPassword; } // ... }