killerwolf/jcdodatawrapper

该软件包已被废弃,不再维护。作者建议使用 h4md1/jcdecaux-cyclocity 软件包代替。
该软件包的最新版本(v1.0.1)没有可用的许可证信息。

PHP类包装器,用于查询JCDECAUX/VLS开放数据REST API

v1.0.1 2014-10-15 06:34 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:24:58 UTC


README

独立的PHP包装器,用于访问所有JCDecaux自行车共享系统的实时数据

安装

使用Composer

按照常规操作

{
    "require": {
        "killerwolf/jcdodatawrapper": "0.*"
    }
}

常规下载

只需从GitHub下载'Wrapper'类,将其加载到您的应用程序中,就像您通常做的那样(常规包含或任何项目使用的自动加载系统)

示例用法

    <?php
    
    require "vendor/autoload.php"; //composer autoloading
    
    //instanciate with your ApiKey provided when you registred by developer.jcdecaux.com
    $VLSWrapper = new JCDodatawrapper\Vls\Wrapper( '<youApiKey>' );
    
    //using curl to handle the requesting thing
    //you can set your own request method by implementing the HTTPClientInterface
    $HTTPClient = new JCDodatawrapper\Vls\HTTPClientCurl();
    $VLSWrapper->setHTTPClient( $HTTPClient );

    //dumping all contracts (all cities that JCDECAUX rules on)
    var_dump( $VLSWrapper->getContracts() );
    
    //dumping the stations details (both static and dynamic) of a particular contract (city)
    var_dump( $VLSWrapper->getStationsByContract( 'Rouen' ) );
    
    //dumping a station data of a particular contract (city)
    var_dump( $VLSWrapper->getStation('Rouen', 15 ) );