Skip to content

kpicaza/react-php-lambda

Repository files navigation

React PHP AWS Lambda

Proof of Concept of Running React PHP in aws lambda server

A proof of concept on how to run React-PHP on a serverless application at AWS Lambda service using Bref.

Contributors

System Requirements

  • AWS Console with configured access keys.
  • Serverless Framework
  • PHP 7.4.3 or greater

Premise

If Node express can run natively in aws lambda, why not run React-PHP?

Goals

  • Execute an Async PSR-7 Request Handler from PSR-11 container
  • Execute an Async callable class from PSR-11 container
  • Execute an Async Bref\Context\Context\Handler from PSR-11 container
  • Execute an Async PSr-7 Request Handler without container
  • Execute an Async Bref\Context\Context\Handler without container
  • Execute an Async anonymous function from file
  • Execute complete async Application like DriftPHP from a unique API Gateway entry-point

Missing Points

  • Check Interest in Bref project to add React-php handler
  • Learn how to deploy React-PHP-FPM 7.4 layer

Especial thanks

  • WyriHaximus, and clue for making React-PHP, adding a complete new paradigm to PHP.
  • mnapoli For making Bref, opening a new world of possibilities for PHP on cloud.
  • mmoreram For giving us he's perspective.

Workaround

  • Use Bref PHP-FPM 7.4 Layer
  • We add a custom bootstrap file using a React PHP event loop instead of the "while=true" loop given by default Bref bootstrap.
  • The given handler is managed with promises by the ReactHandler class
  • We replace the LambdaRuntime class by ReactRuntime

Usage

git clone git@github.com:kpicaza/react-php-lambda.git dev
cd dev
composer install --prefer-dist --optimize-autoloader --no-dev
sls deploy # serverless deploy

Remove stack from AWS

sls remove # serverless remove

Captures

Using Antidot Framework application's container, event dispatcher, and Request handler returning promises.

Logs

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages