PHP code example of feriatos / api-key-bundle

1. Go to this page and download the library: Download feriatos/api-key-bundle 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/ */

    

feriatos / api-key-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Uecode\Bundle\ApiKeyBundle\UecodeApiKeyBundle(),
    );
}

use Uecode\Bundle\ApiKeyBundle\Security\Authentication\Provider\ApiKeyUserProviderInterface;

class MyCustomUserProvider implements ApiKeyUserProviderInterface {
// ...

public function loadUserByApiKey($apiKey)
{
    return $this->userManager->findUserBy(array('apiKey' => $apiKey));
}

}