定制 swp/bridge-bundle 二次开发

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

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

swp/bridge-bundle

Composer 安装命令:

composer require swp/bridge-bundle

包简介

Bundle which acts as a bridge between the Superdesk Web publisher and the Superdesk Content API.

README 文档

README

Build Status Scrutinizer Code Quality Code Climate

This bundle is a bridge between the Superdesk Content API and the Superdesk Publisher.

Installation

  1. Download SWPBridgeBundle
  2. Enable the bundle and its dependencies
  3. Import SWPUpdaterBundle routing file
  4. Configure the SWPBridgeBundle

Step 1: Install SWPBridgeBundle with Composer

Run the following composer require command:

$ php composer.phar require swp/bridge-bundle

Step 2: Enable the bundle and its dependencies

Enable the bundle in AppKernel.php.

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new SWP\Bundle\BridgeBundle\SWPBridgeBundle()
    );
}

Step 3: Import SWPBridgeBundle routing file

You have to import SWPBridgeBundle routing file. You can use YAML or XML format.

YAML:

# app/config/routing.yml
swp_bridge:
    resource: "@SWPBridgeBundle/Resources/config/routing.yml"
    prefix:   /

Step 4: Configure the SWPBridgeBundle

Add the following parameters to your config.yml file.

# app/config/config.yml
swp_bridge:
    api:
        host: 'example.com'
    auth:
        client_id: 'my_client_id'
        username: 'my_username'
        password: 'my_password'

This is a minimum requirement to get started, see the section Everything about configuration for more details.

Everything about configuration

Configuration reference

swp_bridge:
    api:
        host: 'The hostname of your Content API instance. This option is required.'
        port: 'The port of your Content API Instance, defaults to 80.'
        protocol: 'Protocol to use to connect to your Content API Instance, options are: _http_ and _https_. Defaults to _http_.'
    auth:
        client_id: 'Client ID for authenticating with your Content API Instance. This option is required.'
        username: 'Username for authenticating with your Content API Instance. This option is required.'
        password: 'Password for authenticating with your Content API Instance. This option is required.'
    options: 'An array of options which will included in each call in GuzzleApiClient->makeApiCall(). The values defined here will override values from the Request object if the keys are identical.'

Adding custom http client options:

SWPBridgeBundle uses Guzzle to fetch data from the external server. You can add custom Guzzle options / headers for your http client by simply adding an array of options as a parameter in your configuration.
The example below shows how to add custom curl options.

# app/config/config.yml
swp_bridge:
    options:
        curl: # http://guzzle.readthedocs.org/en/latest/faq.html#how-can-i-add-custom-curl-options
            10203: # integer value of CURLOPT_RESOLVE
                 - "example.com:5050:localhost"  # This will resolve the host example.com to your localhost 

For more details see Guzzle documentation.

At this stage, the bundle is ready to be used by your application.

Development Configuration

The above example is specific for the Guzzle client and allows you to do custom hostname resolving, practical when using docker in your devevelopment environment. Just add 127.0.0.1 publicapi to your hosts file and change the value localhost to the ip address of you publicapi docker container.

swp/bridge-bundle 适用场景与选型建议

swp/bridge-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.43k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 08 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 swp/bridge-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 9.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0
  • 更新时间: 2015-08-24