定制 cloudfoundry-community/php-cf-service-broker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cloudfoundry-community/php-cf-service-broker

Composer 安装命令:

composer require cloudfoundry-community/php-cf-service-broker

包简介

A Cloud Foundry service broker made for Cloud Foundry

README 文档

README

Software License Stories in Ready Build Status Scrutinizer Code Quality Code Coverage

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

Quick start

  1. Clone this repo or use composer create-project cloudfoundry-community/php-cf-service-broker

  2. Add your service inside /config/services.json (remove example first)

  3. Create a user by doing this in command line: php bin/addUser.php [user_name] [password]

  4. (optional) Change configuration inside /config/config.yml

  5. 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)

  6. Register your new service broker

  7. 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:
    service.broker.[your broker name]:
         class: Sphring\MicroWebFramework\ServiceBroker\[your broker class name]
         extend: service.broker.abstract
  • Add in this same file a new entry in service.broker.list, example:
    service.broker.list:
      class: \ArrayObject
      constructor:
          1:
            ref:
              default: service.broker.default
              [service name from services.json]: service.broker.[your broker name]
  • Unvalidate cache by doing in command line touch sphring/main.yml or set cache to false inside /config/config.yml
  • Your new service broker is available

Run as a Cloud Foundry app

  1. Create a database service which his name follow this regex: /.*(postgres|pgsql|db|database|my|maria|oracle|oci).*/i (note: add in composer.json other pdo driver than pdo_mysql)
  2. Push the app (run cf push)
  3. Bind your database service on your app
  4. Restage your app
  5. 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

cd app
php -S 0.0.0.0:8888 ../config/routes/router.php

Tests

Tests use PHPUnit. Run with your command line: vendor/bin/phpunit --bootstrap tests\bootstrap.php --no-configuration tests

Add a service to test

  1. Update services.json inside tests configuration directory.
  2. Update service-broker.yml inside tests configuration directory.
  3. Run vendor/bin/phpunit --bootstrap tests\bootstrap.php --no-configuration tests

See also

Open Service Broker API:

K8s Service Catalog:

cloudfoundry-community/php-cf-service-broker 适用场景与选型建议

cloudfoundry-community/php-cf-service-broker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 4, 最近一次更新时间为 2015 年 05 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cloud」 「Cloud Foundry」 「Cf」 「Service Broker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cloudfoundry-community/php-cf-service-broker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cloudfoundry-community/php-cf-service-broker 我们能提供哪些服务?
定制开发 / 二次开发

基于 cloudfoundry-community/php-cf-service-broker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 36
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-10