PHPackages                             madeiramadeirabr/hagrid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. madeiramadeirabr/hagrid

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

madeiramadeirabr/hagrid
=======================

Simplified integration with aws secrets manager.

v1.2.002(4y ago)25.6k[1 PRs](https://github.com/madeiramadeirabr/hagrid/pulls)MITPHPPHP ^7.1|^8.0

Since Nov 25Pushed 2y ago26 watchersCompare

[ Source](https://github.com/madeiramadeirabr/hagrid)[ Packagist](https://packagist.org/packages/madeiramadeirabr/hagrid)[ RSS](/packages/madeiramadeirabr-hagrid/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (14)Used By (0)

Hagrid
======

[](#hagrid)

Simplified integration with AWS Secrets Manager.

Getting Started
---------------

[](#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

[](#prerequisites)

```
* PHP >= 7.1;
* JSON PHP Extension;
* Composer

```

### Installing

[](#installing)

Download the package using composer.

```
composer require madeiramadeirabr/hagrid

```

Basic Usage
-----------

[](#basic-usage)

Basic integration can be accomplished in three ways.

### First Method: Raw Data Retrive

[](#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:

```
$rawData = retrive_secrets($secretId);

```

The response will be something like that:

```
{
    "APP_NAME": "My App Name",
    "APP_ENV": "production"
}

```

### Second Method: Create .env File

[](#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.

```
$fileCreated = create_env_file($directory, $secretId);

```

The response will be TRUE, if the file was created, and FALSE, if don't.

### Third Method: Save data on environment

[](#third-method-save-data-on-environment)

This method will read data from secrets manager and save using putenv.

```
add_env_vars($secretId);

```

This method doesn't have any response.

Use without helpers
-------------------

[](#use-without-helpers)

If EC2 doesn't have role, you can instatiate SecretsManager and pass the the credentials to authenticate.

### First Method

[](#first-method)

Instantiating the SecretsManager class and calling the setters.

```
$secretsManager = new SecretsManager();

$secretsManager->setSecretId($secretId)
    ->setRegion($awsRegion)
    ->setId($myAwsId)
    ->setKey($myAwsKey);

```

### Second Method

[](#second-method)

Instantiating the SecretsManager with AWS credentials.

```
$secretsManager = new SecretsManager($secretId, $awsRegion, $myAwsId, $myAwsKey);

```

### And Finally

[](#and-finally)

After using either of the two methods above, call the method that performs data recovery.

```
$secretValue = $secretsManager->getSecretValue();

```

### Response

[](#response)

The response of the method 'getSecretValue' will be something like this.

```
{
    "APP_NAME": "My App Name",
    "APP_ENV": "production"
}

```

Authors
-------

[](#authors)

- **Lucas Praxedes** - *Initial work* - [Lucas Praxedes](https://github.com/lpraxedes)

See also the list of [contributors](https://github.com/madeiramadeirabr/hagrid/graphs/contributors) who participated in this project.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 69.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Recently: every ~141 days

Total

12

Last Release

1783d ago

PHP version history (2 changes)v1.0.001PHP ^7.1

v1.1.004PHP ^7.1|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2974701?v=4)[Madeira Madeira](/maintainers/madeiramadeirabr)[@madeiramadeirabr](https://github.com/madeiramadeirabr)

---

Top Contributors

[![lpserra](https://avatars.githubusercontent.com/u/20257181?v=4)](https://github.com/lpserra "lpserra (16 commits)")[![FerraBraiZ](https://avatars.githubusercontent.com/u/11755556?v=4)](https://github.com/FerraBraiZ "FerraBraiZ (4 commits)")[![sonarqubemm](https://avatars.githubusercontent.com/u/76051978?v=4)](https://github.com/sonarqubemm "sonarqubemm (3 commits)")

### Embed Badge

![Health badge](/badges/madeiramadeirabr-hagrid/health.svg)

```
[![Health](https://phpackages.com/badges/madeiramadeirabr-hagrid/health.svg)](https://phpackages.com/packages/madeiramadeirabr-hagrid)
```

###  Alternatives

[akeneo/pim-community-dev

Akeneo PIM, the future of catalog management is open!

1.0k624.1k85](/packages/akeneo-pim-community-dev)[altis/core

Core module for Altis

19228.0k3](/packages/altis-core)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[napp/xray-laravel

AWS X-Ray for Laravel applications.

62436.7k](/packages/napp-xray-laravel)[foxxmd/laravel-elasticbeanstalk-cron

Ensure only one Laravel instance is running CRON jobs in an EB environment

62311.8k](/packages/foxxmd-laravel-elasticbeanstalk-cron)[keboola/storage-api-client

Keboola Storage API PHP Client

10405.9k40](/packages/keboola-storage-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
