Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/libgraviton/vcap-config-loader

loads service configs from VCAP_SERVICES
https://github.com/libgraviton/vcap-config-loader

Last synced: 9 days ago
JSON representation

loads service configs from VCAP_SERVICES

Awesome Lists containing this project

README

        

# VCAP_SERVICES loader for php

[![Build Status](https://travis-ci.org/libgraviton/vcap-config-loader.svg?branch=develop)](https://travis-ci.org/libgraviton/vcap-config-loader) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/libgraviton/vcap-config-loader/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/libgraviton/vcap-config-loader/?branch=develop) [![Code Coverage](https://scrutinizer-ci.com/g/libgraviton/vcap-config-loader/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/libgraviton/vcap-config-loader/?branch=develop) [![Latest Stable Version](https://poser.pugx.org/graviton/vcap-config-loader/v/stable.svg)](https://packagist.org/packages/graviton/vcap-config-loader) [![Total Downloads](https://poser.pugx.org/graviton/vcap-config-loader/downloads.svg)](https://packagist.org/packages/graviton/vcap-config-loader) [![Latest Unstable Version](https://poser.pugx.org/graviton/vcap-config-loader/v/unstable.svg)](https://packagist.org/packages/graviton/vcap-config-loader) [![License](https://poser.pugx.org/graviton/vcap-config-loader/license.svg)](https://packagist.org/packages/graviton/vcap-config-loader)

Parses and loads the contents of a vcap services variable as provided by
cloundfoundry clouds.

This is just a very small wrapper around flow/jsonpath. It is intended
to make it easy to configure services based on things cloudfoundry injects
through the VCAP_SERVICES env variable.

This package adheres to [SemVer](http://semver.org/spec/v2.0.0.html) versioning.

It uses a github version of [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) in which new features and bugfixes must be merged to develop
using a github pull request. It uses the standard git-flow naming conventions with the addition of a 'v' prefix to version tags.

## Install

```bash
composer require graviton/vcap-config-loader '*'
```

## Usage

```php
setInput($_ENV['VCAP_SERVICES']);

// what to extract
$type = 'mariadb-';
$name = 'my-awesome-service';

// data extraction
$dbConfig = array(
'db' => $loader->getDb($type, $name),
'host' => $loader->getHost($type, $name),
'port' => $loader->getPort($type, $name),
'database' => $loader->getDatabase($type, $name),
'username' => $loader->getUsername($type, $name),
'password' => $loader->getPassword($type, $name),
);
```