jcroll/foursquare-api-bundle
Composer 安装命令:
composer require jcroll/foursquare-api-bundle
包简介
Symfony bundle for the jcroll/foursquare-api-client
关键字:
README 文档
README
This bundle integrates the JcrollFoursquareApiClient into the Symfony framework.
Why?
This bundle will allow you to easily configure the JcrollFoursquareApiClient and additionally easily allow you to integrate with the HWIOAuthBundle (if you are using it) for signed requests to the foursquare api (see the JcrollFoursquareApiBundleSandbox for examples).
Installation
Add JcrollFoursquareApiBundle in your composer.json:
{ "require": { "jcroll/foursquare-api-bundle": "~1" } }
Download bundle:
$ php composer.phar update jcroll/foursquare-api-bundle
Add the JcrollFoursquareApiBundle to your AppKernel.php
// app/AppKernel.php public function registerBundles() { $bundles = array( ... new Jcroll\FoursquareApiBundle\JcrollFoursquareApiBundle(), ... ); ... }
Basic configuration
-
If you're not using HWIOAuthBundle add your application id and secret parameters (other parameters are optional):
# app/config/config.yml jcroll_foursquare_api: client_id: <your_foursquare_client_id> client_secret: <your_foursquare_client_secret> version: 20140806 # optional mode: foursquare # optional
-
If you are using HWIOAuthBundle configure a
foursquareresource owner and the client's credentials will automatically be configured (unless you wish to specify custom values forversionormode).# app/config/config.yml hwi_oauth: resource_owners: any_name: type: foursquare client_id: <your_foursquare_client_id> # will automatically inject in the client client_secret: <your_foursquare_client_secret> # will automatically inject in the client
Usage
$client = $this->container->get('jcroll_foursquare_client'); $client->setToken($oauthToken); // optional for user specific requests $client->setMode('swarm'); // switch from mode 'foursquare' to 'swarm' $command = $client->getCommand('venues/search', [ 'near' => 'Chicago, IL', 'query' => 'sushi' ]); $results = (array) $client->execute($command); // returns an array of results
You can find a list of the client's available commands in the bundle's client.json but basically they should be the same as the api endpoints listed in the docs.
HWIOAuthBundle Integration
If you are using HWIOAuthBundle this bundle will automatically look for
a resource_owner of type foursquare in that bundle's configuration and inject the client_id and client_secret
into the jcroll_foursquare_client service (no need to configure this bundle unless you want to define custom values
for version or mode).
Additionally a listener will be configured and if the authenticated user possesses an oauth token belonging to foursquare
the token will be automatically injected into the jcroll_foursquare_client service for signed requests (no need to call
setToken).
jcroll/foursquare-api-bundle 适用场景与选型建议
jcroll/foursquare-api-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.34k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2013 年 07 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「client」 「foursquare」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jcroll/foursquare-api-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jcroll/foursquare-api-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jcroll/foursquare-api-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Foursquare Api Client built on Guzzle
A PSR-7 compatible library for making CRUD API endpoints
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
A PHP client library for accessing the Foursquare userless venue endpoint.
Laravel package for the simplification and integration of many of your users most wanted login providers. Installation is a breeze. Never worry about OAuth again.
统计信息
- 总下载量: 17.34k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-07-10