2017 © Pedro Peláez
 

library php-swarmed

image

ikelutra/php-swarmed

  • Wednesday, March 14, 2018
  • by willotter
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PHP-Swarmed

Loads docker secrets into PHP environment variables., (*1)

This is a PHP version of go-swarmed. It was also inspired by phpdotenv., (*2)

Why?

Because most frameworks, e.g. Symfony and Laravel, expect configuration variables as environment variables. Docker correctly recommends not setting sensitive environment variables as other applications can read these and instead recommend secrets. For ease of use this library lets you import these secrets files into environment variables to allow you to use them as you usually would., (*3)

Installation

composer require ikelutra\php-swarmed

Usage

It is fairly simple and will convert the filename of the secret into the uppercase version as the key e.g. /run/secrets/my_simple_secret to MY_SIMPLE_SECRET. The value is the is the contents of the file minus any trailing whitespace., (*4)

$swarmed = new IkeLutra\Swarmed\Swarmed;
$swarmed->load();

By default it won't overwrite existing variables, for example set at runtime or by the Dockerfile. If you would like to overwrite these use:, (*5)

$swarmed = new IkeLutra\Swarmed\Swarmed;
$swarmed->overload();

Testing

The tests use docker-compose. To run them simply do:, (*6)

docker-compose up

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes
  4. Run the tests, adding new ones for your own code if necessary (docker-compose up)
  5. Commit your changes (git commit -am 'Added some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new Pull Request

The Versions

14/03 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Will Otterburn

14/03 2018

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Will Otterburn

14/03 2018

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Will Otterburn