Download the PHP package cloudfoundry-community/cf-helper-php without Composer

On this page you can find all versions of the php package cloudfoundry-community/cf-helper-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cf-helper-php

cf-helper-php

An helper for php application inside cloudfoundry to access application and services bindings information without parsing the json-formatted VCAP_APPLICATION or VCAP_SERVICES env vars. This is similar to the https://www.npmjs.org/package/cfenv node package. You will never have to do this again:

This helper works with official php buildpack.

Usage

This php application is published as a composer package. Fetch it by adding the following to your composer.json:

And include it the page you want to load:

You can access the service binding or application information through the service manager class

Get your service(s)

For example you have a service called database with this credentials:

You can simply get your service like this:

Get Application's informations

Simply like this:

Get a connector

cf-helper-php provide some connectors by auto-detecting.

It give you the possibility to have a PDO object when database is provided in services, or a Predis\Client object when you provide a redis (look at Predis ) or a MongoClient object when a mongodb is provided.

To get this access just follow this this:

You can directly get credentials by doing $cfHelper->get<TypeConnector>Connector()->getCredentials() it will give you an array with:

Example usage of pdo connector

Set php configuration

With cf-helper-php we help you to set your php configuration, add in a new file in root project directory called cfhelper.json a php-ini variable and set your php configuration, example:

Set your php project in development mode

By default this two buildpacks hide error and it's not very good when you're in development phase. With cf-helper-php you can say that you are in development and app will do the rest and even show you error with filp/whoops package, to do that add in a new file in root project directory called cfhelper.json a cfhelper variable and put type variable in developement:

Simulate CloudFoundry environment

You can half simulate a CloudFoudry environment by using a manifest.yml, your environment variable from manifest will be set in $_ENV. You can also add simulate service by adding a key called serviceSimulate in your manifest.yml, example:

To run CloudFoundry simulation simply do:


All versions of cf-helper-php with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cloudfoundry-community/cf-helper-php contains the following files

Loading the files please wait ....