By default it accept x-access-token header.
composer require keiii/silex-apikey-auth
$app->register(new \KEIII\SilexApikeyAuth\ApikeyAuthServiceProvider(), [
'security.firewalls' => [
'api' => [
'pattern' => '^/api',
'apikey' => true,
'users' => $app['user_provider'],
// ...
],
],
// ...
]);
- users: Instance of \KEIII\SilexApikeyAuth\Interfaces\ApikeyUserProviderInterface.
- anonymous (optional): http://silex.sensiolabs.org/doc/master/providers/security.html#allowing-anonymous-users.
- extractor (optional): Instance of \KEIII\SilexApikeyAuth\Interfaces\ApikeyExtractorInterface.