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: 2024-09-24 02:57:43 UTC


README

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

安装

使用composer

像往常一样

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

常规下载

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

示例用法

    <?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 ) );