ttsuru/bref-layer-arns
Composer 安装命令:
composer require ttsuru/bref-layer-arns
包简介
Resolve latest Bref and extra PHP extension layer ARNs from layers.json
README 文档
README
This library provides a CLI tool and PHP API to resolve the latest Lambda Layer ARNs published by Bref, including layers from bref/bref and optionally from bref/extra-php-extensions.
Installation
Install via Composer:
composer require ttsuru/bref-layer-arns
If you also use layers from bref/extra-php-extensions, you should require it as well:
composer require bref/extra-php-extensions
Usage
CLI
Use the CLI to output a comma-separated list of ARNs for the specified layers:
vendor/bin/bref-layer-arns php-84-fpm gd-php-84 insights --region=ap-northeast-1
You can omit the region if you set the AWS_REGION environment variable:
export AWS_REGION=ap-northeast-1
vendor/bin/bref-layer-arns php-84-fpm gd-php-84 insights
The output will be something like:
arn:aws:lambda:ap-northeast-1:534081306603:layer:php-84-fpm:24,arn:aws:lambda:ap-northeast-1:403367587399:layer:gd-php-84:2,arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:14
To use ARM64-specific layers, pass arm-insights instead of insights:
vendor/bin/bref-layer-arns arm-php-84-fpm arm-insights --region=ap-northeast-1
Warning
bref/extra-php-extensions does not provide ARM64 layers. Only x86_64 is supported.
PHP API
You can also use it programmatically:
use Bref\LayerArns\Resolver;
$arns = Resolver::resolve(['php-84-fpm', 'gd-php-84'], 'ap-northeast-1');
Features
- Resolves layers from
bref/bref - Supports optional
bref/extra-php-extensions - Automatically determines correct AWS account ID
- CLI output ready for GitHub Actions or SAM parameter overrides
Testing
Install dev dependencies and run PHPUnit:
composer install
vendor/bin/phpunit
Usage with AWS SAM
You can use the resolved ARNs in your template.yaml with Parameters and Globals like this (supporting multiple layers):
Globals:
Function:
Layers: !Ref BrefLayerArns
Parameters:
BrefLayerArns:
Type: CommaDelimitedList
Default: >-
arn:aws:lambda:ap-northeast-1:534081306603:layer:php-84-fpm:24,
arn:aws:lambda:ap-northeast-1:403367587399:layer:gd-php-84:2
And pass in the latest ARNs dynamically from GitHub Actions:
sam deploy --parameter-overrides BrefLayerArns=$(vendor/bin/bref-layer-arns php-84-fpm --region=$AWS_REGION)
Usage with GitHub Actions
You can dynamically resolve and inject the latest Bref Layer ARNs in your GitHub Actions workflow using this tool.
Example:
env: AWS_REGION: ap-northeast-1 BREF_LAYERS: php-84-fpm gd-php-84 insights jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: '8.4' - name: Install dependencies run: composer install --no-dev - name: Resolve Bref Layer ARNs run: | BREF_LAYER_ARNS=$(vendor/bin/bref-layer-arns $BREF_LAYERS) if [ -z "$BREF_LAYER_ARNS" ]; then echo "Failed to resolve Bref layers." >&2 exit 1 fi echo "BREF_LAYER_ARNS=$BREF_LAYER_ARNS" >> $GITHUB_ENV - name: Deploy with SAM run: | sam deploy \ --parameter-overrides BrefLayerArns=$BREF_LAYER_ARNS
Changelog
See CHANGELOG.md for release history.
License
MIT License – see LICENSE for full text.
ttsuru/bref-layer-arns 适用场景与选型建议
ttsuru/bref-layer-arns 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.91k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 06 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ttsuru/bref-layer-arns 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ttsuru/bref-layer-arns 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-02