New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

agz/laravel-gcp-secret-injector

Include GCP secrets in you laravel environment without explicitly declaring them in your .env files
1,050 1
Install
composer require agz/laravel-gcp-secret-injector
Latest Version:0.2.0
PHP:^7.4|^8.0
License:MIT
Last Updated:Oct 4, 2026
Links: GitHub  ·  Packagist
Maintainer: agz

Load secrets into your environmental variable without declaring it in your .env

This package helps load sensitive data from you Google Cloud Secret Manager into your laravel environment instead of explictly defining it in your .env file.

Prerequisite

You need to already have google/cloud-secret-manager installed in your project.

Installation

You can install this package via composer:

composer require agz/laravel-secret-injector

To publish the config file run the vendor publish command:

php artisan vendor:publish --tag=gcp-secret-injector

Configuration

After publishing the secret inject assets, its configuration will be located at config/secret-injector.php. The configuration allows you to configure you environmental variables against the your Google Cloud secrets.

return [

    'project_id' => env('GOOGLE_CLOUD_PROJECT'),
    'includedEnvs' => ['production'],
    'secrets' => []
];

The project_id points to your google cloud project id. The includedEnvs tells configures what environments which you want the library to be active. For example, by default is configured to be just production. Meaning that once your APP_ENV is set to production, then the library will pull secrets from your Google Cloud Secret Manager in to your environment.

The secrets is used to configure what environmental variables should point to which secrets.

'secrets' => [
        'ENVIROMENTAL_VARIABLE' => 'SECRET_NAME:VERSION',
    ]

For example:

'secrets' => [
        'APP_KEY' => 'APP_KEY:latest',
        'DB_PASSWORD' => 'DB_PASSWORD:1',
    ]

Testing

composer test

Contributors

License

The MIT License (MIT). Please see License File for more information.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

665,354,487 9,703
laravel/framework

The Laravel Framework.

625,568,548 34,998
laravel/tinker

Powerful REPL for the Laravel framework.

531,591,559 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

450,320,528 608
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

424,642,029 4,662

Version History

Version Released PHP License
0.2.0 ^7.4|^8.0 MIT
0.0.1 ^7.4|^8.0 MIT