PHP code example of linkorb / flex-auth
1. Go to this page and download the library: Download linkorb/flex-auth library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
linkorb / flex-auth example snippets
class MyFlexAuthTypeProvider implements FlexAuthTypeProviderInterface {
protected $className = \App\Entities\User::class; // can be change in runtime
protected $propery = 'id';
//...
public function provide(): array { // will be call every time
return [
'type' => 'entity',
'class' => $this->className,
'propery' => $this->propery, // dynamic user identificator
];
}
public function switchToEmail() {
$this->propery = 'email';
}
}
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/