Download the PHP package cloudfoundry-community/php-cf-service-broker without Composer
On this page you can find all versions of the php package cloudfoundry-community/php-cf-service-broker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cloudfoundry-community/php-cf-service-broker
More information about cloudfoundry-community/php-cf-service-broker
Files in cloudfoundry-community/php-cf-service-broker
Package php-cf-service-broker
Short Description A Cloud Foundry service broker made for Cloud Foundry
License MIT
Informations about the package php-cf-service-broker
Cloud Foundry PHP Service Broker
Php project for creating service brokers compatible with Open Service Broker API.
This project for example can be used to quickly implement new service brokers for Kubernetes or Cloud Foundry.
Compatibility
- Open Service Broker API: 2.14
- Asynchronous operations are not supported
- Kubernetes
- v1.10
- Kubernetes Service Catalog: v0.1.35
- Cloud Foundry
- cf-release: 192 or later
- Pivotal CF: Expected 1.4
Quick start
- Clone this repo or use
composer create-project cloudfoundry-community/php-cf-service-broker
- Add your service inside /config/services.json (remove example first)
- Create a user by doing this in command line:
php bin/addUser.php [user_name] [password]
- (optional) Change configuration inside /config/config.yml
- Create the logic inside /src/Sphring/MicroWebFramework/ServiceBroker/DefaultServiceBroker.php (I suggest to see the doc, no need to follow rest url project handle it)
-
Register your new service broker
-
in Kubernetes
by following https://svc-cat.io/docs/resources/#service-brokers
-
in Cloud Foundry
by following http://docs.cloudfoundry.org/services/managing-service-brokers.html#register-broker
-
- Service broker is ready and follow rest url given by the doc
Configuration
Common
See /config/config.yml.
Database
By default this project use an sqlite database, change to another database by modifying this file: /config/doctrine-driver.yml
Adjust logging
See app/app.php
.
By default this application logs only warnings to stdout.
To enable logging to file you can uncomment $logger->pushHandler
line.
To adjust log level you can change \Monolog\Logger::*
value.
For example, to set logging level to debug you can set the value to \Monolog\Logger::DEBUG
.
See Monolog logger source code for details.
Add more service broker
You can add an infinity of service broker to do this follow these steps:
- Add another service inside /config/services.json
- Create a new service broker class and extend Sphring\MicroWebFramework\ServiceBroker\AbstractServiceBroker
-
Register your new broker by adding entry in /sphring/service-broker.yml like this:
-
Add in this same file a new entry in
service.broker.list
, example: - Unvalidate cache by doing in command line
touch sphring/main.yml
or set cache tofalse
inside /config/config.yml - Your new service broker is available
Run as a Cloud Foundry app
- Create a database service which his name follow this regex:
/.*(postgres|pgsql|db|database|my|maria|oracle|oci).*/i
(note: add incomposer.json
other pdo driver than pdo_mysql) - Push the app (run
cf push
) - Bind your database service on your app
- Restage your app
- Service broker app is ready try go to
http://your_url/v2/catalog
you should see your catalog
Development environment
Router for PHP embedded web server
Tests
Tests use PHPUnit.
Run with your command line:
vendor/bin/phpunit --bootstrap tests\bootstrap.php --no-configuration tests
Add a service to test
- Update services.json inside tests configuration directory.
- Update service-broker.yml inside tests configuration directory.
- Run
vendor/bin/phpunit --bootstrap tests\bootstrap.php --no-configuration tests
See also
Open Service Broker API:
K8s Service Catalog:
All versions of php-cf-service-broker with dependencies
ext-pdo Version *
ext-pdo_mysql Version *
ext-pdo_sqlite Version *
sphring/sphring Version 0.12.*
league/route Version ~1.1
league/plates Version ~3.1
monolog/monolog Version ~1.13
filp/whoops Version ~1.1
doctrine/orm Version 2.4.*
jms/serializer Version 0.16.0
sphring/sphring-cache Version dev-master
cloudfoundry-community/cf-helper-php Version 1.5.*
ramsey/uuid Version ^2.8
vierbergenlars/php-semver Version ^3.0