定制 jcroll/foursquare-api-bundle 二次开发

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

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

jcroll/foursquare-api-bundle

Composer 安装命令:

composer require jcroll/foursquare-api-bundle

包简介

Symfony bundle for the jcroll/foursquare-api-client

README 文档

README

Build Status Total Downloads Monthly Downloads Latest Stable Version License

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

  1. 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
  2. If you are using HWIOAuthBundle configure a foursquare resource owner and the client's credentials will automatically be configured (unless you wish to specify custom values for version or mode).

    # 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).

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固