leverage-php/lambda-skeleton 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

leverage-php/lambda-skeleton

Composer 安装命令:

composer require leverage-php/lambda-skeleton

包简介

README 文档

README

Introduction

This project is designed to make it easier to develop a new AWS Lambda function.

It provides:

  • A minimal and empty project which you can base your new Lambda functions on.
  • Dev tools like PHPUnit, PHPStan, CS fixer etc.
  • Running your function locally, including Xdebug.
  • Bref to run PHP runtime on AWS Lambda.
  • Serverless config to easily deploy your function to AWS.
  • GitHub Actions workflows to test your code and automatically deploy functions to AWS.

Usage

To set up a new project, just run:

composer create-project leverage-php/lambda-skeleton

If you use Docker:

docker run -it -v $PWD:/app --rm composer create-project leverage-php/lambda-skeleton

It'll create a new folder with a very minimal project and install all dependencies. You also need:

  • Copy .env.dist to .env and set up your env values.

  • Edit serverless.yml:

#Set up a name of your project. It'll be used in AWS Cloudformation.
service: app

...

functions:
    default:
        #Set up a name for your AWS Lambda function
        name: task-${sls:stage}

That's it.

Development

To invoke your function locally, run:

$ bin/local

# With JSON event data
$ bin/local '{"foo": "bar"}'

# With JSON in a file
$ bin/local --file=event.json

You can use various dev tools thanks to leverage-php/toolchain:

bin/composer - Composer

vendor/bin/test- PHPUnit

vendor/bin/static - PHPStan

vendor/bin/codestyle - PHP CS Fixer

Deployment

To deploy your function, run:

bin/deploy

It'll deploy the project installed on your machine to the dev stage.

Github Actions

There are two predefined workflows to set up Github Actions:

  • on-pull-request.yml runs your test tools (PHPUnit, PHPStan and CS fixer) after creating a pull request.

  • on-push-main.yml deploys your function to AWS to staging after pushing changes to the main branch.

PHP config

PHP is configured by Bref and contains optimized settings for AWS runtime. In case you need to change them, just create a folder php/conf.d in the root of your project and put your php.ini there.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固