Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthieu Napoli:
Serverless Laravel
Jun 05, 2018 @ 11:53:36

In a new post to his site Matthieu Napoli shows how, with the help of the Bref package, to run a serverless Laravel instance. This is a continuation from his previous post covering the use of serverless functionality for running plain PHP.

Serverless basically means “Running apps without worrying about servers”. The main difference with a traditional hosting is that you do not maintain the servers and reserve their capacity. They are scaled up or down automatically and you pay only for what you use.

[...] Serverless hosting has the advantages of scaling very well since there are (theoretically) no limits. It can also help optimize costs by avoiding paying for unused server resources. You can read more about advantages and drawbacks here.

After briefly introducing what "serverless" computing is, he dives right into the creation of the first lambda on AWS. He then goes through the process of creating the new Laravel project, installing and configuring Bref, and wrapping the Laravel functionality in its HTTP handler. Next, he shares an example of the serverless.yml configuration, how to set up the file storage (for things like sessions and cache) and configure the application to run correctly on the lambda. The post finishes out with a look at setting up the logging, session handling and routing before finally deploying the app using Bref's own command.

tagged: laravel serverless tutorial bref framework application lambda aws

Link: http://mnapoli.fr/serverless-laravel/