2017 © Pedro Peláez
 

library namara

The official PHP client for the Namara open data service

image

namara/namara

The official PHP client for the Namara open data service

  • Monday, May 2, 2016
  • by namara
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Namara

The official PHP client for the Namara Open Data service. namara.io, (*1)

Installation

composer require namara/namara

Usage

Instantiation

You need a valid API key in order to access Namara (you can find it in your My Account details on namara.io)., (*2)

To load package, use Composer's autoload., (*3)

require_once 'vendor/autoload.php';

$namara = new Namara({YOUR_API_KEY});

You can also optionally enable debug mode:, (*4)

$namara = new Namara({YOUR_API_KEY}, true);

Getting Data

To make a basic request to the Namara API you can call get on your instantiated object and pass it the ID of the data set you want and the version of the data set:, (*5)

$response = namara->get('5885fce0-92c4-4acb-960f-82ce5a0a4650', 'en-1');

Without a third options argument passed, this will return data with the Namara default offset (0) and limit (250) applied. To specify options, you can pass an options argument:, (*6)

$options = (Object) array('offset' => 0, 'limit' => 150);

$namara->get('5885fce0-92c4-4acb-960f-82ce5a0a4650', 'en-1', options);

Options

All Namara data options are supported., (*7)

Basic options, (*8)

$options = (Object) array(
  'select'=> 'market_nam,website',
  'where' => 'town = "Toronto" AND nearby(geometry, 43.6, -79.4, 10km)',
  'offset' => '0',
  'limit' => '20'
);

Aggregation options Only one aggregation option can be specified in a request, in the case of this example, all options are illustrated, but passing more than one in the options object will throw an error., (*9)

$options = (Object) array(
  'operation' => 'sum(p0)',
  'operation' => 'avg(p0)',
  'operation' => 'min(p0)',
  'operation' => 'max(p0)',
  'operation' => 'count(*)',
  'operation' => 'geocluster(p3, 10)',
  'operation' => 'geobounds(p3)'
);

Running Tests

./vendor/bin/phpunit test_namara.php

License

Apache License, Version 2.0, (*10)

The Versions

02/05 2016

dev-master

9999999-dev

The official PHP client for the Namara open data service

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

api government open data canada independent namara us

02/05 2016

v0.1.2

0.1.2.0

The official PHP client for the Namara open data service

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.3

 

The Development Requires

api government open data canada independent namara us