Matthieu Napoli: Serverless Laravel
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.