PHP code example of happyr / bref-hook-handler

1. Go to this page and download the library: Download happyr/bref-hook-handler 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/ */

    

happyr / bref-hook-handler example snippets




appyr\BrefHookHandler\ApiGatewayFaker;
use Happyr\BrefHookHandler\HookHandler;

return new class extends HookHandler {

    protected function validateDeployment(): bool
    {
        $apiGateway = new ApiGatewayFaker(\getenv('HOOK_VERIFY_FUNCTION_NAME'));
        $response = $apiGateway->request('GET', '/');
        $response->assertStatusCode(200);
        $response->assertBodyContains('Welcome to our site');

        $kernel = new \App\Kernel('prod', false);
        $kernel->boot();
        $kernel->getContainer()->get(CacheAccessChecker::class)->verify();

        // If no exceptions were thrown and we return true, then we will
        // signal CodeDeploy to allow traffic
        return true;
    }
};