定制 elife/content-negotiator 二次开发

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

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

elife/content-negotiator

最新稳定版本:v1.2.1

Composer 安装命令:

composer require elife/content-negotiator

包简介

eLife Sciences content negotiator

README 文档

README

Build Status

This library provides a wrapper around Negotiation.

Dependencies

Installation

composer require elife/content-negotiator

Set up

Silex

use eLife\ContentNegotiator\Silex\ContentNegotiationProvider;
use Negotiation\Accept;

$app->register(new ContentNegotiationProvider());

$app->get('/path', function (Accept $accept) {
    return new Response("Negotiated {$accept->getNormalizedValue()}");
})->before($app['negotiate.accept']('text/plain', 'text/rtf'));

When using symfony/http-kernel 3.1+, you can type-hint an argument on your controller with one of the following types and the result of the negotiation will be used:

Negotiator Type
$app['negotiate.accept'] Negotiation\Accept
$app['negotiate.accept_charset'] Negotiation\AcceptCharset
$app['negotiate.accept_encoding'] Negotiation\AcceptEncoding
$app['negotiate.accept_language'] Negotiation\AcceptLanguage

Running the tests

vendor/bin/phpunit

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 8
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-03