constup-foss/symfony8-aws-secrets-bundle

Symfony bundle for AWS Secrets Manager integration.

Maintainers

Package info

github.com/constup-foss/symfony8-aws-secrets-bundle

Homepage

Type:symfony-bundle

pkg:composer/constup-foss/symfony8-aws-secrets-bundle

Fund package maintenance!

Patreon

Buymeacoffee

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-05-23 15:22 UTC

This package is auto-updated.

Last update: 2026-05-23 15:24:10 UTC


README

Table of Contents

Static Badge Static Badge Static Badge Packagist Downloads

Description

Use AWS Secrets as service container parameter values in Symfony 8.

Note

Thank you for more than 200.000 Packagist downloads of the previous bundle that supported Symfony 5 and 6 (AWS Secrets Bundle). I hope it served you well!

If you are using this library, please take a couple of seconds to star it on GitHub. I have abandoned the development of the previous version because there was barely any feedback. I thought no one uses it. I’ve only found out that it was widely used after checking it on Packagist after a couple of years.

Each star gives me motivation to continue. Thanks!

Prerequisites

PHP and Symfony versions

This bundle is intended to be used on Symfony 8 and PHP 8.4+ (requirement by Symfony 8).

Note about future support

New versions of Symfony will have their own bundles. This significantly reduces complexity when managing updates for the bundle. This bundle may or may not be compatible with Symfony 9 or any other future version. It is intended to be used on Symfony 8 only.

Install AWS SDK PHP v3

You need to install AWS SDK for PHP in your project:

composer require aws/aws-sdk-php
Context

Symfony’s best practices for reusable bundles contain the following statement:

A bundle must not embed third-party PHP libraries. It should rely on the standard Symfony autoloading instead.

This is to avoid having different bundles providing different versions of the same SDK.

Installation

composer require constup-foss/symfony8-aws-secrets-bundle

Configuration

Bundle configuration

By default, configuration for this bundle is loaded from config/packages/symfony8_aws_secrets.yaml (or its environment-specific location like config/packages/test/symfony8_aws_secrets.yaml).

Available configuration properties:

symfony8_aws_secrets:
  client_config:
    region:
    version:
    endpoint:
    profile:
    credentials:
      key:
      secret:
      token:
  delimiter:
  ignore:

Detailed configuration documentation is available here: Configuration.

AWS authentication

This bundle supports several methods of authentication:

  • by loading a profile from your ~/.aws directory

  • by using long-term credentials (AccessKeyId and SecretAccessKey) from your AWS IAM user

  • by using temporary AWS STS tokens

Configuration documentation page describes how to configure this bundle for each method of authentication.

AWS credentials and authentication documentation page describes authenticating in different environments, including how to configure a dockerized AWS CodeBuild pipeline.

Use

Set an environment variable (for example, in your .env file):

YOUR_AWS_SECRET_VARIABLE="your_secret_name_as_saved_in_secret_manager"

This will usually grab a secret in JSON format. To get the value of a specific key from that JSON response, list it after a comma:

YOUR_AWS_SECRET_VARIABLE="your_secret_name_as_saved_in_secret_manager","your_secrets_json_property"

Set the value of a Symfony service container parameter to the value of your environment variable with symfony8_aws_secrets processor applied:

config/services.yaml
parameters:
  your_parameter: "%env(symfony8_aws_secrets:YOUR_AWS_SECRET_VARIABLE)%"

Your secret will now be loaded at runtime.

More examples

License

MIT License

Supporting development

If you like this library or find it useful, consider buying me a nice cup of coffee. Coffee fuels open source.

bmac

default green