定制 rgsystemes/apimapper 二次开发

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

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

rgsystemes/apimapper

最新稳定版本:v3.0.3

Composer 安装命令:

composer require rgsystemes/apimapper

包简介

API wrapper

README 文档

README

Build Status

ApiMapper is a simple wrapper arround Buzz to perform API calls.

Dependencies

This library requires pecl_http to be installed and enabled.

Using APT (Debian/Ubuntu) :

sudo apt-get install -y php-pecl-http

Using PEAR :

sudo pecl install --alldeps pecl_http

Getting started

<?php

$browser = new Buzz\Browser();
$mapper = new ApiMapper\ApiMapper($browser, 'https://api.baseurl.com/api');

$mapper->addEventListener(new AuthenticationListener($sessionManager));
$mapper->addQueryParameter('apiKey', new ApiKeyProvider('someApiKey'));
$mapper->addRouteParameter('{token}', new AuthenticationProvider($sessionManager));

// https://api.baseurl.com/api/auth?apiKey=someApiKey&userName=$userName&password=$password
$response = $mapper->get('auth', array(
    "userName" => $userName,
	"password" => $password
));

// There is no need here to provide the token since it has been
// wrapped when calling auth.
// https://api.baseurl.com/api/1234/some/obscure/12/route
$response = $mapper->get('{token}/some/obscure/{someId}/route', array(
    "{someId}" => 12
));

统计信息

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

GitHub 信息

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

其他信息

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