Download the PHP package madeiramadeirabr/hagrid without Composer
On this page you can find all versions of the php package madeiramadeirabr/hagrid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download madeiramadeirabr/hagrid
More information about madeiramadeirabr/hagrid
Files in madeiramadeirabr/hagrid
Package hagrid
Short Description Simplified integration with aws secrets manager.
License MIT
Informations about the package hagrid
Hagrid
Simplified integration with AWS Secrets Manager.
Getting Started
The purpose of this package is to simplify integration with AWS Secrets Manager, providing an easy way to retrive stored data.
All helpers considers that you have an role in EC2. This role must be allowed to access secrets manager. If EC2 doesn't has role to access SM, you need to create you own helpers using aws id and key to authenticate. All methods are explained here.
Prerequisites
Installing
Download the package using composer.
Basic Usage
Basic integration can be accomplished in three ways.
First Method: Raw Data Retrive
This way retrive the raw json from secrets manager. This is useful if you application need to manipulate environment variables before save it.
To do that, call secrets manager helper, as in the example below:
The response will be something like that:
Second Method: Create .env File
This method will verify if .env file exists, if it don't, it will be created from data retrived from secrets manager.
The response will be TRUE, if the file was created, and FALSE, if don't.
Third Method: Save data on environment
This method will read data from secrets manager and save using putenv.
This method doesn't have any response.
Use without helpers
If EC2 doesn't have role, you can instatiate SecretsManager and pass the the credentials to authenticate.
First Method
Instantiating the SecretsManager class and calling the setters.
Second Method
Instantiating the SecretsManager with AWS credentials.
And Finally
After using either of the two methods above, call the method that performs data recovery.
Response
The response of the method 'getSecretValue' will be something like this.
Authors
- Lucas Praxedes - Initial work - Lucas Praxedes
See also the list of contributors who participated in this project.