A Laravel package to retrieve key management from AWS Secrets Manager

Overview

A Laravel package to retrieve key management from AWS Secrets Manager

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Communication via AWS Secrets Manager may incur unnecessary charges.

So we developed a package that simply caches.

Installation

You can install the package via composer:

composer require getsolaris/laravel-aws-secretsmanager

You can publish the config file with:

php artisan vendor:publish --provider="Getsolaris\LaravelAwsSecretsManager\AwsSecretsManagerServiceProvider" --tag="config"

Usage

You can choose cache driver and cache ttl

default cache driver is filesystem (storage/framework/cache/data)

# .env
CACHE_DRIVER=redis
CACHE_TTL=86400

# aws configuration
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=

Required permissions: secretsmanager:GetSecretValue

If the secret is encrypted using a customer-managed key instead of the AWS managed key aws/secretsmanager

Example

createSecret



namespace App\Services;

use Getsolaris\LaravelAwsSecretsManager\AwsSecretsManager;

class FacebookApiService extends Service
{
    protected AwsSecretsManager $client;
    public function __construct()
    {
        $this->client = new AwsSecretsManager();
    }

    /**
     * @param string $secretId
     * @return array
     * @throws \Exception
     */
    public function createFacebookSecret(): \Aws\Result
    {
        $appId = env('FACEBOOK_APP_ID', 'test_app_id_123');
        $appSecret = env('FACEBOOK_APP_SECRET', 'test_app_secret_123');
        
        $createSecret = new CreateSecretDto(
            Name: 'prod/facebook/secret',
            SecretString: [
                'app_id' => $appId,
                'app_secret' => $appSecret,
            ],
        );
        
        $createSecret = new CreateSecretDto([       
            'Name' => 'prod/facebook/secret',
            'SecretString' => [
                'app_id' => $appId,
                'app_secret' => $appSecret,
            ],
        ]);
    
        return $this->client->createSecret($createSecret);
    }
}

getSecret



namespace App\Services;

use Getsolaris\LaravelAwsSecretsManager\AwsSecretsManager;

class FacebookApiService extends Service
{
    protected AwsSecretsManager $client;
    public function __construct()
    {
        $this->client = new AwsSecretsManager();
    }

    /**
     * @param string $secretId
     * @return array
     * @throws \Exception
     */
    public function getFacebookSecret(): \Aws\Result
    {
        return $this->client->getSecret('prod/facebook/secret');
    }
}

getSecretValue



namespace App\Services;

use Getsolaris\LaravelAwsSecretsManager\AwsSecretsManager;

class FacebookApiService extends Service
{
    protected AwsSecretsManager $client;
    public function __construct()
    {
        $this->client = new AwsSecretsManager();
    }

    /**
     * @param string $secretId
     * @return array
     * @throws \Exception
     */
    public function getFacebookSecretValue(): array
    {
        return $this->client->getSecretValue('prod/facebook/secret');
    }
}

Resource

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

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

You might also like...
Deploy and execute non-PHP AWS Lambda functions from your Laravel application.

Sidecar for Laravel Deploy and execute non-PHP AWS Lambda functions from your Laravel application. Read the full docs at hammerstone.dev/sidecar/docs.

Menu ordering/management application demo, like Wordpress menu manager
Menu ordering/management application demo, like Wordpress menu manager

Menu manager like Wordpress using Laravel and Nestable See demo at: http://laravel-menu-builder.gopagoda.com/admin/menu Tutorial coming up at: http://

Seo Manager Package for Laravel ( with Localization )
Seo Manager Package for Laravel ( with Localization )

Seo Manager Package for Laravel ( with Localization ) lionix/seo-manager package will provide you an interface from where you can manage all your page

laravel - Potion is a pure PHP asset manager for Laravel 5 based off of Assetic.

laravel-potion Potion is a pure PHP asset manager for Laravel based off of Assetic. Description Laravel 5 comes with a great asset manager called Elix

Laravel-tagmanager - An easier way to add Google Tag Manager to your Laravel application.

Laravel TagManager An easier way to add Google Tag Manager to your Laravel application. Including recommended GTM events support. Requirements Laravel

 Laravel Users | A Laravel Users CRUD Management Package
Laravel Users | A Laravel Users CRUD Management Package

A Users Management Package that includes all necessary routes, views, models, and controllers for a user management dashboard and associated pages for managing Laravels built in user scaffolding. Built for Laravel 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0 and 8.0.

Migrator is a GUI migration manager for Laravel which you can create, manage and delete your migration.
Migrator is a GUI migration manager for Laravel which you can create, manage and delete your migration.

Migrator Migrator is a GUI migration manager for Laravel which you can create, manage and delete your migration. Installation: To install Migrator you

Bring multi themes support to your Laravel application with a full-featured Themes Manager
Bring multi themes support to your Laravel application with a full-featured Themes Manager

Introduction hexadog/laravel-themes-manager is a Laravel package which was created to let you developing multi-themes Laravel application. Installatio

File manager for Laravel
File manager for Laravel

Laravel File Manager DEMO: Laravel File Manager Vue.js Frontend: alexusmai/vue-laravel-file-manager Documentation Laravel File Manager Docs Installati

Comments
  • build(deps): bump aglipanci/laravel-pint-action from 1.0.0 to 2.1.0

    build(deps): bump aglipanci/laravel-pint-action from 1.0.0 to 2.1.0

    Bumps aglipanci/laravel-pint-action from 1.0.0 to 2.1.0.

    Release notes

    Sourced from aglipanci/laravel-pint-action's releases.

    v2.1.0

    Fixing aglipanci/laravel-pint-action#1.

    v2.0.0

    Adding the ability to specify the Pint version on the configuration file.

    Commits
    • 5c0b1f6 Fixing the case of setting the testmode to false.
    • 180ac90 Update README.md
    • 07f4f96 Updating README.md
    • c4b9ef6 Merge pull request #3 from aglipanci/version-based-pint
    • 203c2fe Update entrypoint.sh
    • 9258dcb Update entrypoint.sh
    • 18945b8 adding pint version to actions.yml
    • f8d8a4f dynamic pint version
    • 14b329e removing pint installation from the docker file
    • 17f4cb9 moving pint package installation to the entrypoint
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    opened by dependabot[bot] 1
Releases(v1.0.0)
  • v1.0.0(Sep 25, 2022)

    laravel-aws-secretsmanager v1.0.0

    Feature

    • Create Secret
    • Describe Secret
    • Update Secret (Put Secret)
    • Rotate Secret
    • Delete Secret
    • List Secrets
    • Get Secret or Secret Value (SecretString)
    • Refresh (Cache)

    Scheduled Updates

    • Async (Promise)

    New Contributors

    • @getsolaris made their first contribution in https://github.com/getsolaris/laravel-aws-secretsmanager/pull/1

    Full Changelog: https://github.com/getsolaris/laravel-aws-secretsmanager/commits/v1.0.0

    Source code(tar.gz)
    Source code(zip)
Owner
PHP / Laravel
null
A simple laravel package to handle multiple key based model route binding

Laravel Model UUID A simple package to handle the multiple key/column based route model binding for laravel package Installation Require the package u

null 13 Mar 2, 2022
Laravel Manager - provides some manager functionality for Laravel

Laravel Manager Laravel Manager was created by, and is maintained by Graham Campbell, and provides some manager functionality for Laravel. Feel free t

Graham Campbell 371 Dec 17, 2022
Laravel Manager provides some manager functionality for Laravel

Laravel Manager Laravel Manager was created by, and is maintained by Graham Campbell, and provides some manager functionality for Laravel. Feel free t

Graham Campbell 371 Jul 11, 2022
Use eloquent joins in Laravel way, with composite key support.

Eloquent Power Joins with Compoships Support This package is an Eloquent Power Joins extension to support Compoships. You can now use joins in Laravel

Kit Loong 13 Dec 23, 2022
⚙️Laravel Nova Resource for a simple key/value typed setting

Laravel Nova Resource for a simple key/value typed setting Administer your Laravel Simple Setting in Nova Pre-requisites This Nova resource package re

elipZis 5 Nov 7, 2022
⚙️Simple key/value typed settings for your Laravel app with synchronized json export

Simple key/value typed settings for your Laravel app Create, store and use key/value settings, typed from numbers over dates to array, cached for quic

elipZis 8 Jan 7, 2023
Use UUID or Ulid as optional or primary key in Laravel.

Laravel OptiKey Use UUID or Ulid as optional or primary key in Laravel. composer require riipandi/laravel-optikey This package adds a very simple trai

Aris Ripandi 33 Nov 4, 2022
Store and retrieve settings generally or for model objects in Laravel.

Store and retrieve settings generally or for model objects in Laravel. Documentation You can find the detailed documentation here in Laravel Settings

Pharaonic 7 Dec 19, 2022
Retrieve the EC2 Metadata using Laravel's eloquent syntax.

Laravel EC2 Metadata Retrieve the EC2 Metadata using Laravel's eloquent syntax. ?? Supporting If you are using one or more Renoki Co. open-source pack

Renoki Co. 4 Dec 27, 2021
Use auto generated UUID slugs to identify and retrieve your Eloquent models.

Laravel Eloquent UUID slug Summary About Features Requirements Installation Examples Compatibility table Alternatives Tests About By default, when get

Khalyomede 25 Dec 14, 2022