1. Go to this page and download the library: Download graviton/vcap-config-loader library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
graviton / vcap-config-loader example snippets
raviton\Vcap\Loader;
// create loader and inject data
$loader = new Loader;
$loader->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),
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.