Download the PHP package stechstudio/laravel-bref-bridge without Composer

On this page you can find all versions of the php package stechstudio/laravel-bref-bridge. 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 laravel-bref-bridge

bref, the Laravel Way

If you were looking for a way to easily deploy your Laravel project to AWS Lambda, you are in the correct place!

Building on the excellent bref project, we provide a simple and painless entry to the world of Serverless Laravel in AWS.

Installation

Assuming your are in existing Laravel project, let's install the bridge via Composer:

There is a route, config file, and AWS SAM template that needs to be published.

Configuration

TL;DR

Edit .env

AWS

You will need an S3 bucket to send the Function Package to in order for Cloudformation to consume it. Either use an existing bucket, or create a new one. You can easily create a new one with the AWS CLI like this.

.env

New edit your .env file and add:

Region Layers

While there is a default us-east-1 layer configured for you, it is best to reference https://bref.sh/docs/runtimes/ and find the ARN for the latest bref layer in the region you intend to deploy your lambda function.

Note that when you select the base layer, we require one of the php-??-fpm layers. Neither the php-?? nor the console layer types are compatible with this bridge.

Ensure that the region and the layer match, like so:

SQS Job Queue

We will report the created default Job Queue after deployment. The Function will be configured to receive events from it as well as write to it. This means that when you dispatch a job to the default queue, it will trigger the same lambda function to handle the job.

SAM Template

You will now find template.yml in your base directory and you can open it up, review it, edit, or just ignore it for now. When you are done, lets run the configuration command. This will generate a final template based on your .env file. If you modify anything in the .env you should run this command again to update the template.

Lambda Routes

What are lambda routes? Glad you asked! Many people only concern themselves with events from API Gateway and/or AWS SQS that trigger their Lambda Jobs. However, there are a whole slew of events that might be configured to trigger your lambda function.

We have a router implemented for Laravel that makes it trivial for your application to consume and react to events from multiple triggers, all in a single Lambda Function. We use the AWS Events Package to transform the incoming events into the appropriate PHP Object, and then determine what controller to send that event too.

API Gateway

All API Gateway Proxy Request Events are hardwired to be treated as any normal web request. The event will be transformed into an HTTP Request and passed off to PHP-FPM just like nginx or apache would. The result will then be transformed back into the appropriate API Gateway Proxy Response and sent back to the Gateway. All you have to do for this scenario is write your HTTP routes and controllers the same as you would for any traditional Laravel app and, if we did our job correctly, it should just work!

The Other Events

Apart from API Gateway, we currently support routing for all (sixteen) of the other possible events. If you are not using any other events, you can simply ignore this section. However, for those who venture beyond the API Gateway, lets publish the example routes file.

This will result in a routes/lambda.example.php being placed in your project. You will need to manually rename it to routes/lambda.php before it will be used. When you look at it you will notice that it follows the same paradigm as the HTTP Routes. You may either map a callback or map a Lambda Controller.

The router will then ensure that when an event of the type you are routing shows up, it gets passed on to the appropriate callable to handle the event. You simply need to return an array when you are done. To help you with testing the routing of various events, here are some samples.

AWS CloudFormation Create Request Sample Event
Amazon SES Email Receiving Sample Event
Scheduled Event Sample Event
Amazon CloudWatch Logs Sample Event
Amazon SNS Sample Event
Amazon DynamoDB Update Sample Event
Amazon Cognito Sync Trigger Sample Event
Amazon Kinesis Data Streams Sample Event
Amazon S3 Put Sample Event
Amazon S3 Delete Sample Event
Amazon Lex Sample Event
Amazon SQS Event
CloudFront Event
AWS Config Event
AWS IoT Button Event
Kinesis Data Firehose Event

After you publish your package to lambda, you can head over to the AWS console to copy/paste the various samples here into the tests and run them manually. You could also do that from the AWS CLI if want to test from there.

Packaging & Deploying

We have made this as trivial as possible.

This will generate a storage/latest.zip package of your current code. There will be no dev packages from composer, so if you want those packages you will need to move them into the required stanza.

After a few moments, the job will finish and you can head over to the AWS Console to check out your new Lambda Job.

That was it, Congratulations!

Configuration Options

The config/bref.php file holds our configuration options for us. This is a high level overview of the available settings. Please see comments in the file itself for more detail and defaults.

.env Variables

The following .env variables are available to be used. Reference the config/bref.php for more details.

Enable an Extension

If you would like to enable an extension, of simply modify the php.ini directives, you can do so by creating a ./storage/php/conf.d directory. Anything you place in that directory will get packaged to end up in /var/task/php/config.d which is the default for bref.

For example, to enable pdo_mysql, which comes in the base bref layer, just create a ./storage/php/conf.d/mysql.ini file like so:

See: https://bref.sh/docs/environment/php.html#customizing-phpini https://bref.sh/docs/environment/php.html#extensions-installed-but-disabled-by-default


All versions of laravel-bref-bridge with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
ext-curl Version *
ext-json Version *
ext-pcre Version *
ext-iconv Version *
ext-openssl Version *
ext-fileinfo Version *
ext-mbstring Version *
ext-simplexml Version *
ext-tokenizer Version *
ext-parallel Version *
symfony/yaml Version ^4.2
bref/bref Version ^0.3.4
illuminate/http Version ^6.0|^7.0
illuminate/support Version ^6.0|^7.0
laravel/framework Version ^6.0|^7.0
psr/http-server-handler Version ^1.0
stechstudio/aws-events Version ^1.0
symfony/psr-http-message-bridge Version ^1.1
gisostallenberg/file-permission-calculator Version ^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 stechstudio/laravel-bref-bridge contains the following files

Loading the files please wait ....