Load services config from a VCAP_SERVICES json definition.

v0.2.0 2015-02-22 04:52 UTC


Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads Latest Unstable Version License

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 versioning.

It uses a github version of git-flow 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.


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



require 'vendor/autoload.php';

use Graviton\Vcap\Loader;

// create loader and inject data
$loader = new Loader;

// 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),