ap/ap-xml-strategy
Composer 安装命令:
composer require ap/ap-xml-strategy
包简介
XmlStrategy for Zend Framework 2. AP_XmlStrategy select the Xml Render if the ViewModel is an XmlModel or if the Accept header contains 'application/xml' media type.
README 文档
README
Version 1.0.0 created by Alessandro Pietrobelli
Description
Like the latest changes on Zend Framework 2.0.4 version, AP_XmlStrategy select the Xml Render if the ViewModel is an XmlModel or if the Accept header contains "application/xml" media type. Using the new controller plugin acceptableViewModelSelector() you can select and set the appropriate ViewModel if Accept header meets criteria you specify
Require
PHP >= 5.3.3
Zend Framework >= 2.0.4
Installation
with Composer
Add "ap/ap-xml-strategy": "dev-master" to your composer.json file and run php composer.phar update.
with Git submodule
Clone this project to your ```./vendor/`` directory:
git submodule add git://github.com/alessandropietrobelli/AP_XmlStrategy.git vendor/AP_XmlStrategy
enable it on your application.config.php file
<?php return array( 'modules' => array( // ... 'AP_XmlStrategy', ), // ... );
Post Installation
Like on Zend Framework 2.0.4 change log example
<?php namespace SomeNamespace\Controller; use Zend\View\Model\JsonModel; use Zend\View\Model\FeedModel; use AP_XmlStrategy\View\Model\XmlModel; class SomeController extends AbstractActionController { protected $acceptCriteria = array( 'Zend\View\Model\JsonModel' => array( 'application/json', ), 'Zend\View\Model\FeedModel' => array( 'application/rss+xml', ), 'AP_XmlStrategy\View\Model\XmlModel' => array( 'application/xml', ), ); public function apiAction() { $viewModel = $this->acceptableViewModelSelector($this->acceptCriteria); if ($viewModel instanceof JsonModel) { return new JsonModel(array( 'response' => 'foo', ) ); } if ($viewModel instanceof FeedModel) { return new FeedModel(array( 'response' => 'foo', ) ); } if ($viewModel instanceof XmlModel){ return new XmlModel(array( 'response' => 'foo', ) ); } } }
ap/ap-xml-strategy 适用场景与选型建议
ap/ap-xml-strategy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.7k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2012 年 12 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「xml」 「zf2」 「ZendFramework」 「strategy」 「xmlstrategy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ap/ap-xml-strategy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ap/ap-xml-strategy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ap/ap-xml-strategy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LosLog provides some log utility
EdpModuleLayouts is very simple Laminas module for making module-specific layouts insanely easy.
Load DOM document safety
Zend Framework module to leverage the symfony dependency injection container
RCM User HTML views/pages
Builds a Bridge between Zend Expressive and Plugin Managers of Zend\MVC
统计信息
- 总下载量: 14.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-12-04