2017 © Pedro Peláez
 

library tflcycles

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

image

jessicadigital/tflcycles

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

  • Friday, April 1, 2016
  • by jessicadigital
  • Repository
  • 1 Watchers
  • 1 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 13 % Grown

The README.md

jessicadigital/tflcycles

A module to fetch Santander Cycle hire locations within a distance of specified locations. Read more on the blog., (*1)

Installation

To include this package in your project, use composer:, (*2)

composer install jessicadigital/tflcycles, (*3)

Fetching hire locations

To fetch locations, first create a new instance of the TflCycles class:, (*4)

$tflcycles = new \JessicaDigital\TflCycles\TflCycles();, (*5)

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

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

You must specify one or more locations., (*8)

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

$tflcycles->setDistance(2000);, (*10)

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

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., (*12)

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:, (*13)

// 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., (*14)

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., (*15)

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., (*16)

The Versions

01/04 2016

dev-master

9999999-dev

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

  Sources   Download

by Jessica Digital

31/03 2016

v1.0.0

1.0.0.0

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

  Sources   Download

by Jessica Digital