Download the PHP package f-lombardo/secrets-loader without Composer

On this page you can find all versions of the php package f-lombardo/secrets-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package secrets-loader

OpenSSF Scorecard Quality Gate Status OpenSSF Best Practices

Load secrets

Automatically load secrets from SSM into environment variables when running with Bref.

This work is a fork of the project created by Matthieu Napoli, who is also the creator of the amazing Bref project.

I introduced here the ability to load parameters from Secrets Manager and to have an SSM parameter containing many application environment variables in ini format.

Load secrets from Secrets Manager

This library replaces at runtime secrets read from AWS Secrets Manager. Those secrets can be both in JSON format or in plain text.

In this example the Bref Lambda function will see an environment variable MY_PARAMETER which value will be the content of secret /my-app/my-parameter-in-plain-text. Secret pointed by /my-app/my-parameter-in-json should be a JSON string of the form:

The Lambda function will have access to two environment variables VAR1=value1 and VAR2=value2.

SSM parameter in .ini format

Migrating an existing complex Symfony application to Bref leads to having many environment variables defined in serverless.yml. Instead of having a one to one mapping between lambda environment variables and SSM parameters, I suggest to have a single lambda environment variable with the special name BREF_PARAMETER_STORE that stores a string in ini format. That string will be expanded in many application environment variables. For example a lambda could have the environment variable BREF_PARAMETER_STORE=ssm:/some/parameter. Data contained in that parameter could be:

The lambda execution runtime should then see VAR1=foo and VAR2=bar as environment variables.

This project is fully compatible with the behavior of the original library, whose documentation I report below.

Usage following the original library

This library is fully compatible with the orginal one developed by Bref's author. Read the Bref documentation: https://bref.sh/docs/environment/variables.html#secrets

It replaces (at runtime) the variables whose value starts with bref-ssm:. For example, you could set such a variable in serverless.yml like this:

In AWS Lambda, the MY_PARAMETER would be automatically replaced and would contain the value stored at /my-app/my-parameter in AWS SSM Parameters.

It could be also used to read a set of parameters from a SSM variable that contains a string in an INI format. For example, if there is an SSM parameter /my-app/my-par-store that contains this sting:

and we have this severless.yml configuration with the special variable BREF_PARAMETER_STORE set this way:

our lambda will see the these environment variables:

This feature is shipped as a separate package so that all its code and dependencies are not installed by default for all Bref users. Install this package if you want to use the feature.

Notes for developers

In the docker directory you can find a docker compose project that allows the developing and testing of the application. You can run it with

Last command leads you inside the PHP container where you can run tests and quality checks using the quality.sh script:

Installation in your PHP project


All versions of secrets-loader with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
async-aws/ssm Version ^1.3
async-aws/secrets-manager Version ^2.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package f-lombardo/secrets-loader contains the following files

Loading the files please wait ....