GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - brefphp/constructs: AWS CDK constructs for PHP applications with Bref

BranchesTags
Open more actions menu

Latest commit

 

History

50 Commits
50 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.prettierrc.yaml
.prettierrc.yaml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eslint.config.js
eslint.config.js
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.test.json
tsconfig.test.json
 
 

Repository files navigation

AWS CDK constructs for PHP on AWS Lambda

The Bref CDK constructs let you deploy serverless PHP applications on AWS Lambda using the AWS CDK.

By default, Bref deploys using the Serverless Framework. Using the AWS CDK is an alternative, but be aware that this is an advanced topic. If you are lost, follow the Bref documentation instead.

Installation

Install the package with NPM:

npm install @bref.sh/constructs

Usage

Simple example to deploy an HTTP application:

import { Construct } from 'constructs';
import { App, Stack } from 'aws-cdk-lib';
import { PhpFpmFunction } from '@bref.sh/constructs';

class MyStack extends Stack {
    constructor(scope: Construct, id: string, props?: StackProps) {
        super(scope, id, props);

        new PhpFpmFunction(this, 'Hello', {
            handler: 'public/index.php',
        });
    }
}

const app = new App();
new MyStack(app, 'test', {
    env: {
        region: 'eu-west-1',
    },
});

Constructs

Functions

PhpFpmFunction

This construct deploys a PHP function with the HTTP runtime.

new PhpFpmFunction(this, 'MyFunction', {
    handler: 'public/index.php',
});

It inherits from the AWS CDK Function construct with these options set by default:

  • handler: index.php by default
  • runtime: provided.al2023
  • code: the code is automatically zipped from the current directory.
  • layers: the Bref layer is automatically added.
  • memorySize: 1024
  • timeout: 28 (seconds)

The code is automatically zipped from the current directory. You can override this behavior by setting the code property:

import { packagePhpCode } from '@bref.sh/constructs';

new PhpFpmFunction(this, 'MyFunction', {
    code: packagePhpCode('custom-path', {
        exclude: ['docs'],
    }),
});

The following paths are always excluded: .git, .idea, cdk.out, node_modules, .bref, .serverless, tests.

The construct also adds the following options:

  • phpVersion (default: 8.4): the PHP version to use.

PhpFunction

This construct deploys a PHP function with the "event-driven function" runtime.

new PhpFunction(this, 'MyFunction', {
    handler: 'my-handler.php',
});

It inherits from the AWS CDK Function construct with these options set by default:

  • runtime: provided.al2023
  • code: the code is automatically zipped from the current directory.
  • layers: the Bref layer is automatically added.
  • memorySize: 1024
  • timeout: 6 (seconds)

The code is automatically zipped from the current directory. You can override this behavior by setting the code property:

import { packagePhpCode } from '@bref.sh/constructs';

new PhpFunction(this, 'MyFunction', {
    // ...
    code: packagePhpCode('custom-path', {
        exclude: ['docs'],
    }),
});

The following paths are always excluded: .git, .idea, cdk.out, node_modules, .bref, .serverless, tests.

The construct also adds the following options:

  • phpVersion (default: 8.4): the PHP version to use.

ConsoleFunction

This construct deploys a PHP function with the "console" runtime.

new ConsoleFunction(this, 'Artisan', {
    handler: 'artisan',
});

It inherits from the AWS CDK Function construct with these options set by default:

  • runtime: provided.al2023
  • code: the code is automatically zipped from the current directory.
  • layers: the Bref layer is automatically added.
  • memorySize: 1024
  • timeout: 6 (seconds)

The code is automatically zipped from the current directory. You can override this behavior by setting the code property:

import { packagePhpCode } from '@bref.sh/constructs';

new ConsoleFunction(this, 'Artisan', {
    // ...
    code: packagePhpCode('custom-path', {
        exclude: ['docs'],
    }),
});

The following paths are always excluded: .git, .idea, cdk.out, node_modules, .bref, .serverless, tests.

The construct also adds the following options:

  • phpVersion (default: 8.4): the PHP version to use.

About

AWS CDK constructs for PHP applications with Bref

Resources

Readme
MIT license
Activity
Custom properties

Stars

32 stars

Watchers

3 watching

Forks

4 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.