PHPackages                             lambdaphp/lambdaphp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. lambdaphp/lambdaphp

ActiveProject

lambdaphp/lambdaphp
===================

Quick and Dirty PHP website hosting on Aws Lambda (pay by requests instead of monthly hosting fees)

v0.3.3(7y ago)43951323MITPHPPHP &gt;=7.0

Since Nov 6Pushed 6y ago22 watchersCompare

[ Source](https://github.com/san-kumar/lambdaphp)[ Packagist](https://packagist.org/packages/lambdaphp/lambdaphp)[ RSS](/packages/lambdaphp-lambdaphp/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

LambdaPHP v0.02
===============

[](#lambdaphp-v002)

Host your website on Aws Lambda with full PHP 7 support (i.e. pay by requests instead of paying a fixed monthly hosting fee).

Now it's possible for you to host dynamic PHP files, static HTML files, css files on AWS Lambda (serverless) just like an Apache server running mod\_php. Any files you put inside the `public` directory will be accessible as if they were hosted on an Apache server with `mod_php`. There are no handlers to write or config files to maintain.

For example, put two files, *index.php* and *deep/other.php* inside your `public` folder. The type `lambdaphp deploy -v`. Once deployed you should be able to access them online at , , etc (details below).

But why should I care?
----------------------

[](#but-why-should-i-care)

**The Difference is you don't have to pay any monthly hosting fees** because they're running on AWS Lambda which means you are billed only by the number of requests. This includes 1 million free requests per month and 400,000 GB-seconds of compute time per month ([details here](https://aws.amazon.com/lambda/pricing/)).

Other advantages of going serverless include
--------------------------------------------

[](#other-advantages-of-going-serverless-include)

- ### Super fast deployments:

    [](#super-fast-deployments)

    With just a simple command your updates are live instantly.
- ### Unlimited scalability:

    [](#unlimited-scalability)

    Aws Lambda can scale from 0 to virtually infinite instances without any extra code or setup. So whether your site gets one hit or a million hits a day it can handle all scenarios easily.
- ### Ultra Low cost:

    [](#ultra-low-cost)

    Are you hosting your site on a $500 server yet not fully utilizing all server resources? AWS lambda is billed by number of requests not by monthly usage, so for a site that gets less than a million requests per month it is virtually free forever!
- ### Focus on your ideas not servers:

    [](#focus-on-your-ideas-not-servers)

    Are you spending a lot of time configuring load balancers, docker containers, etc to handle loads? Now you don't have to since it's all done for you.
- ### Improved latency and geolocation:

    [](#improved-latency-and-geolocation)

    Why make a user in India connect to a server thousands of miles away in America? Even if your site is super fast, the download will still be slow because of network latency. Aws Lambda Edge makes it possible for users to connect to the nearest server making the downloads super fast.
- ### No server vulnerabilities:

    [](#no-server-vulnerabilities)

    Since the lambda instances (or web servers) are created on demand and destroyed after each request, it makes it virtually impossible to hack your web server or install any malware on it.
- ### No server admin:

    [](#no-server-admin)

    Same as above. No need to patch or upgrade packages as they are managed by the vendor. Plus the server is read-only an created and destroyed after each request, making it virtually impossible to exploit or install malware on it.

Installation
------------

[](#installation)

Installation is simple. All you need is PHP 7+ with [`composer`](https://getcomposer.org)

To install, just type this on your command line (terminal)

```
composer create-project lambdaphp/lambdaphp

```

This should create a *project-name* directory inside which there is a `public` directory. Any files, including any PHP files you put in the `public` directory can be accessed directly from your web browser.

Once you're done putting files in the `public` folder, just type this on your command line to deploy your site on AWS Lambda:

```
lambdaphp deploy -v

```

*You may need to enter your AWS credentials as [described here](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) (same as aws-cli)*.

If everything goes as expected, you should see this message:

```
Website deployed!
To access your site visit:
https://XXXX.execute-api.us-east-1.amazonaws.com/web/&lt;any-file-in-public-folder>
