定制 jessicadigital/tflcycles 二次开发

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

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

jessicadigital/tflcycles

Composer 安装命令:

composer require jessicadigital/tflcycles

包简介

A module to fetch Santander Cycle availability within a distance of specified locations.

README 文档

README

A module to fetch Santander Cycle hire locations within a distance of specified locations. Read more on the blog.

Installation

To include this package in your project, use composer:

composer install jessicadigital/tflcycles

Fetching hire locations

To fetch locations, first create a new instance of the TflCycles class:

$tflcycles = new \JessicaDigital\TflCycles\TflCycles();

Now, specify your location(s) to find nearby hire stations:

$tflcycles->addLocation($latitude, $longitude);

You must specify one or more locations.

Next, set the search distance (in metres), e.g.

$tflcycles->setDistance(2000);

for 2km. This will find all bike hire locations within 2km of any of the specified locations. The default is 1000m.

Now, perform a search. Use the find() method to return an array of stations, or save($filename) to save this array directly to a file.

Example

This example will fetch all cycle hire stations within 500m of Euston and Waterloo rail stations and save to a file called cycles.json:

// Create object
$tflcycles = new \JessicaDigital\TflCycles\TflCycles();

// Add location - Euston Station
$tflcycles->addLocation(51.5290371, -0.1368696);

// Add location - Waterloo Station
$tflcycles->addLocation(51.5031686, -0.1144991);

// Change distance to 500m
$tflcycles->setDistance(500);

// Save the found locations to a file called cycles.json
$tflcycles->save('cycles.json');

Usage

This package uses the TfL Santander Cycle API. Please abide by their Terms and Conditions.

Do not make repeated requests to the API - the data is only updated every five minutes. The recommended approach for using this package is to set up a scheduled CRON job to fetch and cache the data you need.

This project has no connection with TfL or the bike hire scheme; it was created as part of a development project and released for the community to enjoy.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-03-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固