I gave a talk on serverless PHP at LonghornPHP 2022. This is the companion article I wrote for it. If you’re just looking for the slides, click here.
For PHP developers, servers occupy a weird space in our lives. We can’t work without them. But, for most of us, managing them is something that we’d rather avoid. Instead, we’re happy to pay for hosting companies to take the pain away.
But hosting companies don’t remove all your hosting headaches. If you’re managing a server yourself (or with the help of a tool like Laravel Forge or SpinupWP), you’re still on the hook if something happens and you still have to maintain them. (Ubuntu LTS still has a end of life! 😅)
And even with Platform-as-a-Service (PaaS), you’re not completely off the hook. You have to worry about scaling. This often leaves you overpaying for hosting because you have to be on a plan that can handle the worst-case scenario.
These are some problems that serverless PHP addresses. With serverless PHP, you pay for what you use. If your PHP application isn’t receiving any traffic, you’re not paying to keep a server online. But, at the same time, you get an infrastructure that can scale to handle thousands of requests within a minute.