sunkan/serverless-config-builder

Library to help with programmatically generate serverless.yml

dev-main 2022-08-25 15:19 UTC

This package is auto-updated.

Last update: 2024-11-25 19:56:55 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status

Installation

$ composer require sunkan/serverless-config-builder

Usage

use Sunkan\ServerlessConfigBuilder\Builder;
use Sunkan\ServerlessConfigBuilder\Entities\HttpFunction;
use Sunkan\ServerlessConfigBuilder\Entities\SqsFunction;

$builder = Builder::fromTemplate(__DIR__ . '/resources/serverless.template.yml');
$builder->addFunction(HttpFunction::fromObject(TestAction::class));
$sqsFunction = new SqsFunction(
'sqs-handler',
    TestAction::class,
    'arn:to:queue',
);
$builder->addFunction($sqsFunction);
$builder->save('serverless.yml');