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.4k[1 PRs](https://github.com/madeiramadeirabr/hagrid/pulls)MITPHPPHP ^7.1|^8.0

Since Nov 25Pushed 1y ago26 watchersCompare

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

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

36

—

LowBetter than 82% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity21

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

1730d ago

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

v1.1.004PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c7d108b0e17b4f0a7f511cd5cd573d3619319e374495af678a06ee4a2b4b9fd?d=identicon)[madeiramadeirabr](/maintainers/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

[aws/aws-sdk-php-symfony

A Symfony bundle for v3 of the AWS SDK for PHP

36517.7M22](/packages/aws-aws-sdk-php-symfony)[csharpru/vault-php

Best Vault client for PHP that you can find

8410.3M4](/packages/csharpru-vault-php)[napp/xray-laravel

AWS X-Ray for Laravel applications.

61407.3k](/packages/napp-xray-laravel)[helgesverre/extractor

AI-Powered Data Extraction for your Laravel application.

22128.0k](/packages/helgesverre-extractor)[dreamonkey/laravel-cloudfront-url-signer

Laravel 5.6+ wrapper around CloudFront canned signed URLs

54750.7k](/packages/dreamonkey-laravel-cloudfront-url-signer)[foxxmd/laravel-elasticbeanstalk-cron

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

62299.6k](/packages/foxxmd-laravel-elasticbeanstalk-cron)

PHPackages © 2026

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