sunaoka / aws-ssm-parameters-loader-php
Load values from AWS SSM Parameter store into environment variables
Installs: 1 516
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- aws/aws-sdk-php: ^3.20.1
Requires (Dev)
- phpstan/phpstan: ^1.12.0
- phpunit/phpunit: ^9.6 || ^10.5 || ^11.2
This package is auto-updated.
Last update: 2024-10-30 05:10:27 UTC
README
Load values from AWS SSM Parameter store into environment variables for Laravel
Installation
composer require sunaoka/aws-ssm-parameters-loader-php
Usage
Create a SSM Parameter
aws ssm put-parameter --name '/path/to/value' --type String --value 'my secret value'
Example 1
use Aws\Ssm\SsmClient; use Sunaoka\SsmParametersLoader\ParametersLoader; putenv('MY_PARAMETER=ssm:/path/to/value') $client = new SsmClient([ // arguments ]); $loader = new ParametersLoader($client, 'ssm:'); $loader->load(); echo env('MY_PARAMETER'); // my secret value
Example 2
use Aws\Ssm\SsmClient; use Sunaoka\SsmParametersLoader\ParametersLoader; putenv('MY_PARAMETER=ssm:/path/to/value') $client = new SsmClient([ // arguments ]); $loader = new ParametersLoader($client, 'ssm:'); $result = $loader->getParameters(); var_dump($result); // array(1) { // 'MY_PARAMETER' => // string(15) "my secret value" // }