承接 liip/multiplex-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

liip/multiplex-bundle

最新稳定版本:1.1.2

Composer 安装命令:

composer require liip/multiplex-bundle

包简介

This Bundles enables 'multiplexing' multiple requests into a single Request/Response

关键字:

README 文档

README

This bundle is no longer maintained. Feel free to fork it if needed.

Overview Build Status

This Bundles enables "multiplexing" multiple requests into a single Request/Response:

for example this request:

http://foo.com/multiplex.json?requests[login][uri]=/session/new&requests[notification][uri]=/notifications&requests[notification][method]=get&requests[notification][parameters][]=broadcasts&requests[notification][parameters][]=personal

will internally call:

/session/new and /notifications

and return one Response:

{
    "/session/new"   : {"request" : "/session/new", "status": 200, "response": "the Response Content of /session/new"},
    "/notifications" : {"request" : "/notifications", "status": 403, "response": "Forbidden"}
}

Attention: Installing this Bundle basically lets anyone side step the security firewall. Therefore its important to either secure the multiplex route or to implement security checks inside all relevant controllers

Installation

  1. Add this bundle to your project with Composer:
```
$ php composer.phar require liip/multiplex-bundle
```
  1. Add this bundle to your application's kernel:
``` php
  // app/AppKernel.php
  public function registerBundles()
  {
      return array(
          // ...
          new Liip\MultiplexBundle\LiipMultiplexBundle(),
          // ...
      );
  }
```

Configuration

The following Configuration Options exists:

  • allow_externals : if enabled also external urls can be multiplexed (default: true)
  • display_errors : if enabled and an error occured, the error message will be returned, otherwise (if available) the http status code message (default: true)
  • route_option : only used in combination with restrict_routes, defines the route option which should be looked up if restrict_routes is on (default: multiplex_expose)
  • restrict_routes : if enabled only routes with the route_option are multiplexable (default: false)

Application Configuration

here the default config

liip_multiplex:
    allow_externals: true
    display_errors: true
    route_option: 'multiplex_expose'
    restrict_routes: false

Routing Configuration

if you want to restrict multiplexing to specific routes, define the option in each route you want to expose

<route id="_my_route" pattern="/foo/bar">
    <default key="_controller">MyBundle:Controller:index</default>
    <option key="multiplex_expose">true</option>
</route>

and don't forget to set restrict_routes to true!

Usage

This Bundles provides a decent Javascript Library to use the Multiplexer Endpoint.

Integration of the Javascript

  {% javascripts
  "@LiipMultiplexBundle/Resources/public/js/ajax_multiplexer.js"
    output='js/multiplexer.js'
  %}
    <script src="{{ asset_url }}"></script>
  {% endjavascripts %}

Using the Javascript Multiplexer

//configuring the Multiplexer
Multiplexer.setEndpoint('/path/to/multiplexer/endpoint'); //as in your routing defaults to /multiplex.json
Multiplexer.setFormat('json'); //only useful exchange format

//adding Requests to the Multiplexer
Multiplexer.add(
    {'uri' : '/foo/bar', 'method' : 'GET', 'parameters' : {'foo':'bar'}}, //the Request Object
    function(content) { /* ... */}, // the Success Callback
    function(content) { /* ... */}  // the Error Callback
);

Multiplexer.add(
    {'uri' : 'http://google.com', 'method' : 'GET', 'parameters' : {'q':'Symfony2'}},
    function(content) { /* this callback is called on success for this request*/},
    function(content) { /* this callback is called on error for this request*/}
);

//pushing all Requests to the Server
Multiplexer.call(
    function(r){ /* ... */ }, //the global success callback (optional)
    function(r){ /* ... */ } //the global error callback (optional)
);

//pushing only a set of Requests to the Server
Multiplexer.call(['/foo/bar']);

Tests

  1. To run the unit tests, require all dependencies
```
$ php composer.phar update --dev
```
  1. Run PHPUnit
```
$ phpunit
```
  1. See Travis for automated Tests
https://travis-ci.org/liip/LiipMultiplexBundle

TODO

  • more output formats (usable html/xml formats)

liip/multiplex-bundle 适用场景与选型建议

liip/multiplex-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 48 次下载、GitHub Stars 达 12, 最近一次更新时间为 2013 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 48
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 49
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-30