{"id":13828219,"url":"https://github.com/stechstudio/laravel-bref-bridge","last_synced_at":"2025-07-09T05:31:56.859Z","repository":{"id":57059330,"uuid":"172143015","full_name":"stechstudio/laravel-bref-bridge","owner":"stechstudio","description":"Bref, the Laravel way.","archived":true,"fork":false,"pushed_at":"2020-03-10T12:44:11.000Z","size":193,"stargazers_count":71,"open_issues_count":4,"forks_count":5,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-05T09:17:30.642Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stechstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-22T22:27:56.000Z","updated_at":"2024-02-20T18:16:19.000Z","dependencies_parsed_at":"2022-08-24T07:30:32.652Z","dependency_job_id":null,"html_url":"https://github.com/stechstudio/laravel-bref-bridge","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-bref-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-bref-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-bref-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stechstudio%2Flaravel-bref-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stechstudio","download_url":"https://codeload.github.com/stechstudio/laravel-bref-bridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225486571,"owners_count":17481930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T09:02:37.134Z","updated_at":"2024-11-20T07:31:41.322Z","avatar_url":"https://github.com/stechstudio.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"## bref, the Laravel Way\nIf you were looking for a way to easily deploy your Laravel project to AWS Lambda, you are in the correct place!\n\nBuilding on the excellent [bref](https://github.com/mnapoli/bref) project, we provide a simple and painless entry to the world of Serverless Laravel in AWS.\n\n## Installation\n\nAssuming your are in existing Laravel project, let's install the bridge via Composer:\n\n```\n$ composer require stechstudio/laravel-bref-bridge\n```\n\nThere is a route, config file, and AWS SAM template that needs to be published.\n\n```\n$ artisan vendor:publish --tag=bref-routes --tag=bref-sam-template --tag=bref-configuration\n```\n\n## Configuration\n#### TL;DR\n*Edit `.env`*\n```ini\nBREF_NAME=\"\u003cmy-lambdas-name\u003e\"\nBREF_S3_BUCKET=\"\u003cbucket-name\u003e\"\n```\n\n```sh\n$ artisan vendor:publish --tag=bref-sam-template --tag=bref-configuration\n$ artisan bref:config-sam\n$ artisan vendor:publish --tag=bref-routes\n$ mv routes/lambda.example.php routes/lambda.php\n$ artisan bref:package\n$ artisan bref:deploy\n```\n\n### AWS\nYou 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.\n```sh\n$ aws s3 mb s3://\u003cbucket-name\u003e\n```\n\n### .env\nNew edit your `.env` file and add:\n\n```ini\nBREF_NAME=\"\u003cmy-lambdas-name\u003e\"\nBREF_S3_BUCKET=\"\u003cbucket-name\u003e\"\n```\n#### Region Layers\nWhile 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.\n\nNote 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.\n\nEnsure that the region and the layer match, like so:\n```ini\nBREF_DEFAULT_REGION=ap-southeast-1\nBREF_FUNCTION_LAYER_1=arn:aws:lambda:ap-southeast-1:209497400698:layer:php-73-fpm:6\n```\n\n### SQS Job Queue\nWe 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.\n\n### SAM Template\n```\n$ artisan vendor:publish --tag=bref-sam-template\n```\nYou 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.\n```\n$ artisan bref:config-sam\n```\n### Lambda Routes\nWhat 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.\n\nWe 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](https://packagist.org/packages/stechstudio/aws-events) to transform the incoming events into the appropriate PHP Object, and then determine what controller to send that event too.\n\n#### API Gateway\nAll [API Gateway Proxy Request Events](https://github.com/stechstudio/aws-events/blob/master/src/Events/ApiGatewayProxyRequest.php) 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!*\n\n#### The Other Events\nApart 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.\n\n```\n$ artisan vendor:publish --tag=bref-routes\n```\nThis 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](routes/lambda.php) you will notice that it follows the same paradigm as the HTTP Routes. You may either map a callback or map a Lambda Controller. \n\nThe 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. \n\n\u003cdetails\u003e\n  \u003csummary\u003eAWS CloudFormation Create Request Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"StackId\": \"arn:aws:cloudformation:us-west-2:EXAMPLE/stack-name/guid\",\n  \"ResponseURL\": \"http://pre-signed-S3-url-for-response\",\n  \"ResourceProperties\": {\n    \"StackName\": \"stack-name\",\n    \"List\": [\n      \"1\",\n      \"2\",\n      \"3\"\n    ]\n  },\n  \"RequestType\": \"Create\",\n  \"ResourceType\": \"Custom::TestResource\",\n  \"RequestId\": \"unique id for this create request\",\n  \"LogicalResourceId\": \"MyTestResource\"\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon SES Email Receiving Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"Records\": [\n    {\n      \"eventVersion\": \"1.0\",\n      \"ses\": {\n        \"mail\": {\n          \"commonHeaders\": {\n            \"from\": [\n              \"Jane Doe \u003cjanedoe@example.com\u003e\"\n            ],\n            \"to\": [\n              \"johndoe@example.com\"\n            ],\n            \"returnPath\": \"janedoe@example.com\",\n            \"messageId\": \"\u003c0123456789example.com\u003e\",\n            \"date\": \"Wed, 7 Oct 2015 12:34:56 -0700\",\n            \"subject\": \"Test Subject\"\n          },\n          \"source\": \"janedoe@example.com\",\n          \"timestamp\": \"1970-01-01T00:00:00.000Z\",\n          \"destination\": [\n            \"johndoe@example.com\"\n          ],\n          \"headers\": [\n            {\n              \"name\": \"Return-Path\",\n              \"value\": \"\u003cjanedoe@example.com\u003e\"\n            },\n            {\n              \"name\": \"Received\",\n              \"value\": \"from mailer.example.com (mailer.example.com [203.0.113.1]) by inbound-smtp.us-west-2.amazonaws.com with SMTP id o3vrnil0e2ic for johndoe@example.com; Wed, 07 Oct 2015 12:34:56 +0000 (UTC)\"\n            },\n            {\n              \"name\": \"DKIM-Signature\",\n              \"value\": \"v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=example; h=mime-version:from:date:message-id:subject:to:content-type; bh=jX3F0bCAI7sIbkHyy3mLYO28ieDQz2R0P8HwQkklFj4=; b=sQwJ+LMe9RjkesGu+vqU56asvMhrLRRYrWCbV\"\n            },\n            {\n              \"name\": \"MIME-Version\",\n              \"value\": \"1.0\"\n            },\n            {\n              \"name\": \"From\",\n              \"value\": \"Jane Doe \u003cjanedoe@example.com\u003e\"\n            },\n            {\n              \"name\": \"Date\",\n              \"value\": \"Wed, 7 Oct 2015 12:34:56 -0700\"\n            },\n            {\n              \"name\": \"Message-ID\",\n              \"value\": \"\u003c0123456789example.com\u003e\"\n            },\n            {\n              \"name\": \"Subject\",\n              \"value\": \"Test Subject\"\n            },\n            {\n              \"name\": \"To\",\n              \"value\": \"johndoe@example.com\"\n            },\n            {\n              \"name\": \"Content-Type\",\n              \"value\": \"text/plain; charset=UTF-8\"\n            }\n          ],\n          \"headersTruncated\": false,\n          \"messageId\": \"o3vrnil0e2ic28tr\"\n        },\n        \"receipt\": {\n          \"recipients\": [\n            \"johndoe@example.com\"\n          ],\n          \"timestamp\": \"1970-01-01T00:00:00.000Z\",\n          \"spamVerdict\": {\n            \"status\": \"PASS\"\n          },\n          \"dkimVerdict\": {\n            \"status\": \"PASS\"\n          },\n          \"processingTimeMillis\": 574,\n          \"action\": {\n            \"type\": \"Lambda\",\n            \"invocationType\": \"Event\",\n            \"functionArn\": \"arn:aws:lambda:us-west-2:012345678912:function:Example\"\n          },\n          \"spfVerdict\": {\n            \"status\": \"PASS\"\n          },\n          \"virusVerdict\": {\n            \"status\": \"PASS\"\n          }\n        }\n      },\n      \"eventSource\": \"aws:ses\"\n    }\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eScheduled Event Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"account\": \"123456789012\",\n  \"region\": \"us-east-1\",\n  \"detail\": {},\n  \"detail-type\": \"Scheduled Event\",\n  \"source\": \"aws.events\",\n  \"time\": \"1970-01-01T00:00:00Z\",\n  \"id\": \"cdc73f9d-aea9-11e3-9d5a-835b769c0d9c\",\n  \"resources\": [\n    \"arn:aws:events:us-east-1:123456789012:rule/my-schedule\"\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon CloudWatch Logs Sample Event\u003c/summary\u003e\n\n```json\n{\n \"awslogs\": {\n \"data\": \"H4sIAAAAAAAAAHWPwQqCQBCGX0Xm7EFtK+smZBEUgXoLCdMhFtKV3akI8d0bLYmibvPPN3wz00CJxmQnTO41whwWQRIctmEcB6sQbFC3CjW3XW8kxpOpP+OC22d1Wml1qZkQGtoMsScxaczKN3plG8zlaHIta5KqWsozoTYw3/djzwhpLwivWFGHGpAFe7DL68JlBUk+l7KSN7tCOEJ4M3/qOI49vMHj+zCKdlFqLaU2ZHV2a4Ct/an0/ivdX8oYc1UVX860fQDQiMdxRQEAAA==\"\n }\n }\n ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon SNS Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"Records\": [\n    {\n      \"EventVersion\": \"1.0\",\n      \"EventSubscriptionArn\": eventsubscriptionarn,\n      \"EventSource\": \"aws:sns\",\n      \"Sns\": {\n        \"SignatureVersion\": \"1\",\n        \"Timestamp\": \"1970-01-01T00:00:00.000Z\",\n        \"Signature\": \"EXAMPLE\",\n        \"SigningCertUrl\": \"EXAMPLE\",\n        \"MessageId\": \"95df01b4-ee98-5cb9-9903-4c221d41eb5e\",\n        \"Message\": \"Hello from SNS!\",\n        \"MessageAttributes\": {\n          \"Test\": {\n            \"Type\": \"String\",\n            \"Value\": \"TestString\"\n          },\n          \"TestBinary\": {\n            \"Type\": \"Binary\",\n            \"Value\": \"TestBinary\"\n          }\n        },\n        \"Type\": \"Notification\",\n        \"UnsubscribeUrl\": \"EXAMPLE\",\n        \"TopicArn\": topicarn,\n        \"Subject\": \"TestInvoke\"\n      }\n    }\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon DynamoDB Update Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"Records\": [\n    {\n      \"eventID\": \"1\",\n      \"eventVersion\": \"1.0\",\n      \"dynamodb\": {\n        \"Keys\": {\n          \"Id\": {\n            \"N\": \"101\"\n          }\n        },\n        \"NewImage\": {\n          \"Message\": {\n            \"S\": \"New item!\"\n          },\n          \"Id\": {\n            \"N\": \"101\"\n          }\n        },\n        \"StreamViewType\": \"NEW_AND_OLD_IMAGES\",\n        \"SequenceNumber\": \"111\",\n        \"SizeBytes\": 26\n      },\n      \"awsRegion\": \"us-west-2\",\n      \"eventName\": \"INSERT\",\n      \"eventSourceARN\": eventsourcearn,\n      \"eventSource\": \"aws:dynamodb\"\n    },\n    {\n      \"eventID\": \"2\",\n      \"eventVersion\": \"1.0\",\n      \"dynamodb\": {\n        \"OldImage\": {\n          \"Message\": {\n            \"S\": \"New item!\"\n          },\n          \"Id\": {\n            \"N\": \"101\"\n          }\n        },\n        \"SequenceNumber\": \"222\",\n        \"Keys\": {\n          \"Id\": {\n            \"N\": \"101\"\n          }\n        },\n        \"SizeBytes\": 59,\n        \"NewImage\": {\n          \"Message\": {\n            \"S\": \"This item has changed\"\n          },\n          \"Id\": {\n            \"N\": \"101\"\n          }\n        },\n        \"StreamViewType\": \"NEW_AND_OLD_IMAGES\"\n      },\n      \"awsRegion\": \"us-west-2\",\n      \"eventName\": \"MODIFY\",\n      \"eventSourceARN\": sourcearn,\n      \"eventSource\": \"aws:dynamodb\"\n    },\n    {\n      \"eventID\": \"3\",\n      \"eventVersion\": \"1.0\",\n      \"dynamodb\": {\n        \"Keys\": {\n          \"Id\": {\n            \"N\": \"101\"\n          }\n        },\n        \"SizeBytes\": 38,\n        \"SequenceNumber\": \"333\",\n        \"OldImage\": {\n          \"Message\": {\n            \"S\": \"This item has changed\"\n          },\n          \"Id\": {\n            \"N\": \"101\"\n          }\n        },\n        \"StreamViewType\": \"NEW_AND_OLD_IMAGES\"\n      },\n      \"awsRegion\": \"us-west-2\",\n      \"eventName\": \"REMOVE\",\n      \"eventSourceARN\": sourcearn,\n      \"eventSource\": \"aws:dynamodb\"\n    }\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon Cognito Sync Trigger Sample Event\u003c/summary\u003e\n\n```json\n   {\n  \"datasetName\": \"datasetName\",\n  \"eventType\": \"SyncTrigger\",\n  \"region\": \"us-east-1\",\n  \"identityId\": \"identityId\",\n  \"datasetRecords\": {\n    \"SampleKey2\": {\n      \"newValue\": \"newValue2\",\n      \"oldValue\": \"oldValue2\",\n      \"op\": \"replace\"\n    },\n    \"SampleKey1\": {\n      \"newValue\": \"newValue1\",\n      \"oldValue\": \"oldValue1\",\n      \"op\": \"replace\"\n    }\n  },\n  \"identityPoolId\": \"identityPoolId\",\n  \"version\": 2\n}  \n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon Kinesis Data Streams Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"Records\": [\n    {\n      \"eventID\": \"shardId-000000000000:49545115243490985018280067714973144582180062593244200961\",\n      \"eventVersion\": \"1.0\",\n      \"kinesis\": {\n        \"partitionKey\": \"partitionKey-3\",\n        \"data\": \"SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IDEyMy4=\",\n        \"kinesisSchemaVersion\": \"1.0\",\n        \"sequenceNumber\": \"49545115243490985018280067714973144582180062593244200961\"\n      },\n      \"invokeIdentityArn\": identityarn,\n      \"eventName\": \"aws:kinesis:record\",\n      \"eventSourceARN\": eventsourcearn,\n      \"eventSource\": \"aws:kinesis\",\n      \"awsRegion\": \"us-east-1\"\n    }\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon S3 Put Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"Records\": [\n    {\n      \"eventVersion\": \"2.0\",\n      \"eventTime\": \"1970-01-01T00:00:00.000Z\",\n      \"requestParameters\": {\n        \"sourceIPAddress\": \"127.0.0.1\"\n      },\n      \"s3\": {\n        \"configurationId\": \"testConfigRule\",\n        \"object\": {\n          \"eTag\": \"0123456789abcdef0123456789abcdef\",\n          \"sequencer\": \"0A1B2C3D4E5F678901\",\n          \"key\": \"HappyFace.jpg\",\n          \"size\": 1024\n        },\n        \"bucket\": {\n          \"arn\": bucketarn,\n          \"name\": \"sourcebucket\",\n          \"ownerIdentity\": {\n            \"principalId\": \"EXAMPLE\"\n          }\n        },\n        \"s3SchemaVersion\": \"1.0\"\n      },\n      \"responseElements\": {\n        \"x-amz-id-2\": \"EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH\",\n        \"x-amz-request-id\": \"EXAMPLE123456789\"\n      },\n      \"awsRegion\": \"us-east-1\",\n      \"eventName\": \"ObjectCreated:Put\",\n      \"userIdentity\": {\n        \"principalId\": \"EXAMPLE\"\n      },\n      \"eventSource\": \"aws:s3\"\n    }\n  ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon S3 Delete Sample Event\u003c/summary\u003e\n\n```json\n  {\n  \"Records\": [\n    {\n      \"eventVersion\": \"2.0\",\n      \"eventTime\": \"1970-01-01T00:00:00.000Z\",\n      \"requestParameters\": {\n        \"sourceIPAddress\": \"127.0.0.1\"\n      },\n      \"s3\": {\n        \"configurationId\": \"testConfigRule\",\n        \"object\": {\n          \"sequencer\": \"0A1B2C3D4E5F678901\",\n          \"key\": \"HappyFace.jpg\"\n        },\n        \"bucket\": {\n          \"arn\": bucketarn,\n          \"name\": \"sourcebucket\",\n          \"ownerIdentity\": {\n            \"principalId\": \"EXAMPLE\"\n          }\n        },\n        \"s3SchemaVersion\": \"1.0\"\n      },\n      \"responseElements\": {\n        \"x-amz-id-2\": \"EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH\",\n        \"x-amz-request-id\": \"EXAMPLE123456789\"\n      },\n      \"awsRegion\": \"us-east-1\",\n      \"eventName\": \"ObjectRemoved:Delete\",\n      \"userIdentity\": {\n        \"principalId\": \"EXAMPLE\"\n      },\n      \"eventSource\": \"aws:s3\"\n    }\n  ]\n} \n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon Lex Sample Event\u003c/summary\u003e\n\n```json\n{\n  \"messageVersion\": \"1.0\",\n  \"invocationSource\": \"FulfillmentCodeHook or DialogCodeHook\",\n  \"userId\": \"user-id specified in the POST request to Amazon Lex.\",\n  \"sessionAttributes\": { \n     \"key1\": \"value1\",\n     \"key2\": \"value2\",\n  },\n  \"bot\": {\n    \"name\": \"bot-name\",\n    \"alias\": \"bot-alias\",\n    \"version\": \"bot-version\"\n  },\n  \"outputDialogMode\": \"Text or Voice, based on ContentType request header in runtime API request\",\n  \"currentIntent\": {\n    \"name\": \"intent-name\",\n    \"slots\": {\n      \"slot-name\": \"value\",\n      \"slot-name\": \"value\",\n      \"slot-name\": \"value\"\n    },\n    \"confirmationStatus\": \"None, Confirmed, or Denied\n      (intent confirmation, if configured)\"\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAmazon SQS Event\u003c/summary\u003e\n\n```json\n{\n     \"Records\": [\n        {\n            \"messageId\": \"c80e8021-a70a-42c7-a470-796e1186f753\",\n            \"receiptHandle\": \"AQEBJQ+/u6NsnT5t8Q/VbVxgdUl4TMKZ5FqhksRdIQvLBhwNvADoBxYSOVeCBXdnS9P+erlTtwEALHsnBXynkfPLH3BOUqmgzP25U8kl8eHzq6RAlzrSOfTO8ox9dcp6GLmW33YjO3zkq5VRYyQlJgLCiAZUpY2D4UQcE5D1Vm8RoKfbE+xtVaOctYeINjaQJ1u3mWx9T7tork3uAlOe1uyFjCWU5aPX/1OHhWCGi2EPPZj6vchNqDOJC/Y2k1gkivqCjz1CZl6FlZ7UVPOx3AMoszPuOYZ+Nuqpx2uCE2MHTtMHD8PVjlsWirt56oUr6JPp9aRGo6bitPIOmi4dX0FmuMKD6u/JnuZCp+AXtJVTmSHS8IXt/twsKU7A+fiMK01NtD5msNgVPoe9JbFtlGwvTQ==\",\n            \"body\": \"{\\\"foo\\\":\\\"bar\\\"}\",\n            \"attributes\": {\n                \"ApproximateReceiveCount\": \"3\",\n                \"SentTimestamp\": \"1529104986221\",\n                \"SenderId\": \"594035263019\",\n                \"ApproximateFirstReceiveTimestamp\": \"1529104986230\"\n            },\n            \"messageAttributes\": {},\n            \"md5OfBody\": \"9bb58f26192e4ba00f01e2e7b136bbd8\",\n            \"eventSource\": \"aws:sqs\",\n            \"eventSourceARN\": \"arn:aws:sqs:us-west-2:594035263019:NOTFIFOQUEUE\",\n            \"awsRegion\": \"us-west-2\"\n        }\n    ]\n}\n```\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eCloudFront Event\u003c/summary\u003e\n\n```json\n{\n  \"Records\": [\n    {\n      \"cf\": {\n        \"config\": {\n          \"distributionId\": \"EDFDVBD6EXAMPLE\"\n        },\n        \"request\": {\n          \"clientIp\": \"2001:0db8:85a3:0:0:8a2e:0370:7334\",\n          \"method\": \"GET\",\n          \"uri\": \"/picture.jpg\",\n          \"headers\": {\n            \"host\": [\n              {\n                \"key\": \"Host\",\n                \"value\": \"d111111abcdef8.cloudfront.net\"\n              }\n            ],\n            \"user-agent\": [\n              {\n                \"key\": \"User-Agent\",\n                \"value\": \"curl/7.51.0\"\n              }\n            ]\n          }\n        }\n      }\n    }\n  ]\n}\n ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAWS Config Event\u003c/summary\u003e\n\n```json\n{ \n    \"invokingEvent\": \"{\\\"configurationItem\\\":{\\\"configurationItemCaptureTime\\\":\\\"2016-02-17T01:36:34.043Z\\\",\\\"awsAccountId\\\":\\\"000000000000\\\",\\\"configurationItemStatus\\\":\\\"OK\\\",\\\"resourceId\\\":\\\"i-00000000\\\",\\\"ARN\\\":\\\"arn:aws:ec2:us-east-1:000000000000:instance/i-00000000\\\",\\\"awsRegion\\\":\\\"us-east-1\\\",\\\"availabilityZone\\\":\\\"us-east-1a\\\",\\\"resourceType\\\":\\\"AWS::EC2::Instance\\\",\\\"tags\\\":{\\\"Foo\\\":\\\"Bar\\\"},\\\"relationships\\\":[{\\\"resourceId\\\":\\\"eipalloc-00000000\\\",\\\"resourceType\\\":\\\"AWS::EC2::EIP\\\",\\\"name\\\":\\\"Is attached to ElasticIp\\\"}],\\\"configuration\\\":{\\\"foo\\\":\\\"bar\\\"}},\\\"messageType\\\":\\\"ConfigurationItemChangeNotification\\\"}\",\n    \"ruleParameters\": \"{\\\"myParameterKey\\\":\\\"myParameterValue\\\"}\",\n    \"resultToken\": \"myResultToken\",\n    \"eventLeftScope\": false,\n    \"executionRoleArn\": \"arn:aws:iam::012345678912:role/config-role\",\n    \"configRuleArn\": \"arn:aws:config:us-east-1:012345678912:config-rule/config-rule-0123456\",\n    \"configRuleName\": \"change-triggered-config-rule\",\n    \"configRuleId\": \"config-rule-0123456\",\n    \"accountId\": \"012345678912\",\n    \"version\": \"1.0\"\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eAWS IoT Button Event\u003c/summary\u003e\n\n```json\n{\n  \"serialNumber\": \"ABCDEFG12345\",\n  \"clickType\": \"SINGLE\",\n  \"batteryVoltage\": \"2000 mV\"\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eKinesis Data Firehose Event\u003c/summary\u003e\n\n```json\n{\n  \"invocationId\": \"invoked123\",\n  \"deliveryStreamArn\": \"aws:lambda:events\",\n  \"region\": \"us-west-2\",\n  \"records\": [\n    {\n      \"data\": \"SGVsbG8gV29ybGQ=\",\n      \"recordId\": \"record1\",\n      \"approximateArrivalTimestamp\": 1510772160000,\n      \"kinesisRecordMetadata\": {\n        \"shardId\": \"shardId-000000000000\",\n        \"partitionKey\": \"4d1ad2b9-24f8-4b9d-a088-76e9947c317a\",\n        \"approximateArrivalTimestamp\": \"2012-04-23T18:25:43.511Z\",\n        \"sequenceNumber\": \"49546986683135544286507457936321625675700192471156785154\",\n        \"subsequenceNumber\": \"\"\n      }\n    },\n    {\n      \"data\": \"SGVsbG8gV29ybGQ=\",\n      \"recordId\": \"record2\",\n      \"approximateArrivalTimestamp\": 151077216000,\n      \"kinesisRecordMetadata\": {\n        \"shardId\": \"shardId-000000000001\",\n        \"partitionKey\": \"4d1ad2b9-24f8-4b9d-a088-76e9947c318a\",\n        \"approximateArrivalTimestamp\": \"2012-04-23T19:25:43.511Z\",\n        \"sequenceNumber\": \"49546986683135544286507457936321625675700192471156785155\",\n        \"subsequenceNumber\": \"\"\n      }\n    }\n  ]\n}  \n```\n\n\u003c/details\u003e\n\nAfter 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.\n\n## Packaging \u0026 Deploying\nWe have made this as trivial as possible. \n\n```\n$ artisan bref:package\n```\nThis 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. \n\n```\n$ artisan bref:deploy\n```\nAfter a few moments, the job will finish and you can head over to the AWS Console to check out your new Lambda Job.\n\n\nThat was it, Congratulations!\n\n# Configuration Options\nThe `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.\n * **name** - This value is the name of your Lambda. This value is used when the framework needs to generate the lambda function names.\n * **description** - This value is the description of your Lambda. This value is used when the framework needs to generate the lambda function descriptions.\n * **region** - This value is the region of your Lambda. This value is used when the framework needs to generate the lambda function regions.\n * **timeout** - This value is the timeout, in seconds, to configure the lambda function for. The API Gateway timeout is 30 seconds, so that is our default.  The maximum timeout is 900 seconds (15 minutes).\n * **memory_size** - The amount of memory that your function has access to. Increasing the function's memory also increases it's CPU allocation. The default value is 128 MB and the maximum value is 3,008 MB. The value must be an integer multiple of 64 MB.\n * **layers** - A list of function layers to add to the function's execution environment. Specify each layer by ARN, including the version, in the order they should be layered, with a maximum of five layers.\n * **keep** - The number of latest (zip) packages to keep on the filesystem.\n * **sqs** - Lambda consumption of job queues gets configured here. Publishing jobs to queues still works as normal, So no changes there. Just update the .env\n * **packaging** - This array configures the files that should be ignored when packaging your application, as well as identifying executable files.\n * **env** - This array configures environment variables that are passed in for function code, as well as listing those that are ignored.\n\n# .env Variables\nThe following `.env` variables are available to be used. Reference the `config/bref.php` for more details.\n * **BREF_NAME** - This value is the name of your Lambda. This value is used when the framework needs to generate the lambda function names.\n * **BREF_DESCRIPTION** - This value is the description of your Lambda. This value is used when the framework needs to generate the lambda function descriptions.\n * **BREF_DEFAULT_REGION** - This value is the region of your Lambda. This value is used when the framework needs to generate the lambda function regions.\n * **BREF_FUNCTION_TIMEOUT** - This value is the timeout, in seconds, to configure the lambda function for. The API Gateway timeout is 30 seconds, so that is our default. The maximum timeout is 900 seconds (15 minutes).\n * **BREF_FUNCTION_MEMORY_SIZE** -The amount of memory that your function has access to. Increasing the function's memory also increases it's CPU allocation. The default value is 128 MB and the maximum value is 3,008 MB. The value must be an integer multiple of 64 MB.\n * **BREF_FUNCTION_LAYER_1** - The ARN, including version, of the first layer. This will override the default layer. \n * **BREF_FUNCTION_LAYER_2** - The ARN, including version, of the second layer, if used.\n * **BREF_FUNCTION_LAYER_3** - The ARN, including version, of the third layer, if used.\n * **BREF_FUNCTION_LAYER_4** - The ARN, including version, of the fourth layer, if used.\n * **BREF_FUNCTION_LAYER_5** - The ARN, including version, of the fifth layer, if used.\n * **BREF_PACKAGE_KEEP** - The number of latest (zip) packages to keep on the filesystem.\n * **BREF_APP_STORAGE** - Where the laravel app storage should be. Defaults to `/tmp/storage`.\n * **BREF_LOG_CHANNEL** - How to handle logging in lambda. Defaults to `stderr`.\n * **BREF_CACHE_DRIVER** - The cache driver to use in Lambda. Defaults to `file`.\n * **BREF_SESSION_DRIVER** - The Session driver to use in Lambda. Defaults to `array`.\n * **BREF_QUEUE_CONNECTION** - The queue connection to use in Lambda. Defaults to `sqs`.\n\n# Enable an Extension\nIf 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. \nAnything you place in that directory will get packaged to end up in `/var/task/php/config.d` which is the default for bref.\n\nFor example, to enable `pdo_mysql`, which comes in the base bref layer, just create a `./storage/php/conf.d/mysql.ini` file like so:\n\n```ini\nextension=pdo_mysql\n```\n\nSee: \nhttps://bref.sh/docs/environment/php.html#customizing-phpini\nhttps://bref.sh/docs/environment/php.html#extensions-installed-but-disabled-by-default\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstechstudio%2Flaravel-bref-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstechstudio%2Flaravel-bref-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstechstudio%2Flaravel-bref-bridge/lists"}