GithubHelp home page GithubHelp logo

rahulyhg / serverless-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from araines/serverless-php

0.0 1.0 0.0 8.22 MB

PHP for AWS Lambda via Serverless Framework

License: MIT License

Shell 10.52% JavaScript 21.19% PHP 68.29%

serverless-php's Introduction

serverless-php

serverless language license

PHP for AWS Lambda via Serverless Framework using Symfony components for dependency injection.

Latest version is on master.

AWS Lambda lets you run code without thinking about servers. Right now you can author your AWS Lambda functions in several langauges natively, but not PHP. This project aims to provide a fully featured shim for authoring your AWS Lambda functions in PHP.

More information about how this works and its performance characteristics can be found on my blog post.

Preview

<?php

use Raines\Serverless\Context;
use Raines\Serverless\Handler;

class HelloHandler implements Handler
{
    public function handle(array $event, Context $context)
    {
        return [
            'statusCode' => 200,
            'body' => 'Hello World!',
        ];
    }
}

Features

Event Data Context Logging Exceptions Environment API Gateway
full full part none full full

Usage

Prerequisites

Install this project:

serverless install --url https://github.com/araines/serverless-php

Currently serverless install does not work with Git LFS. Hopefully this will be supported in the future, but for the moment here are your options:

  1. Rebuild the PHP binary (described later in this document)
  2. Download the PHP binary directly from GitHub
  3. Instead of using serverless install, ensure you have Git LFS installed on your system and clone the repository.

Deploying to AWS

composer install -o --no-dev
serverless deploy

Running locally

serverless invoke local -f hello

Running on AWS

serverless invoke -f hello

Rebuilding PHP Binary

The PHP binary can be built with any flags you require and at any version.

Prerequisites

Compiling

sh buildphp.sh

Altering compile flags etc

Edit buildphp.sh and dockerfile.buildphp to alter it.

Thanks

serverless-php's People

Contributors

jakzal avatar amitmerchant1990 avatar bmoffatt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.