Download the PHP package happyr/bref-hook-handler without Composer

On this page you can find all versions of the php package happyr/bref-hook-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bref-hook-handler

Bref Hook Handler

Latest Version Total Downloads

This small library helps you to make sure the new version of your lambda application is actually working before you directing traffic it. It makes it simple to run a "PreTrafficHook".

Install

We also need serverless-plugin-canary-deployments from davidgf:

Configure

The idea is to create a new lambda function that can verify that everything is working. When we are sure all things are green, we will signal CodeDeploy to allow real traffic.

Example serverless.yml

Example prehook.php

The prehook script is where you start your application kernel, test writing to the database, dispatch a message on the queue etc etc. If you use the HookHandler it will automatically communicate back to CodeDeploy.

One can of course add as much or little logic as one need.

Making HTTP requests

In the example above we are making a HTTP request to our homepage. We cannot use API Gateway because it does not route traffic to the new Lambda version. So we invoke the lambda version directly with parameters that look like it comes from ApiGateway. The ApiGatewayFaker helps us with that.

This is the only reason why we need to configure lambda:InvokeFunction in the IAM Role.

Note

If the prehook.php does not make a request to CodeDeploy then the deployment will hey stuck at "Checking Stack update progress". This is a good thing. This ensures that the prehook script always reports "Succeeded".

Check the CloudWatch logs if this happens.

Cool, lets to canary deployments!

It is tempting to change the deploymentSettings.type to something else but "AllAtOnce" to expose your new version to 10% of the requests first... But it might not be optimal. Consider reading this article first: https://lumigo.io/blog/canary-deployment-for-aws-lambda/


All versions of bref-hook-handler with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
ext-json Version *
async-aws/code-deploy Version ^1.0
async-aws/lambda Version ^1.0
bref/bref Version ^0.5.20 || ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package happyr/bref-hook-handler contains the following files

Loading the files please wait ....