Skip to content

howlowck/socrata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socrata

An easy API wrapper for Socrata API using Guzzle

Feature

  • Easily intergrates with Laravel
  • Chicago Service provider

"Install"

add to composer.json

in composer.json add following in require:

"howlowck/socrata": "dev-master"

set configuration file (optional)

run php artisan config:publish howlowck/socrata then change the values according under app/config/packages/howlowck/socrata/config.php

add service provider (optional)

In app/config/app.php add the following in providers

'Howlowck\Socrata\SocrataChicagoServiceProvider',

That will load the Socrata Chicago Data Portal routes, and register the wrapper as a singleton.

Usage

Create a Socrata Instance
If you didn't use the service provider, you can easily create a Socrata instance like so:

$soc = new Howlowck\Socrata\Socrata($baseUrl, $secret_token, $public_token);

Create a Request
Without service provider (con't from above)

$request = $soc->createRequest('7as2-ds3y');

Or with service provider loaded for Chicago

$request  = App::make('socrata-chicago')->createRequest('7as2-ds3y');

filter on Socrata datasource with SoQL query
You can use query keywards outlined on socrata's site as methods

$request->where('number_of_potholes_filled_on_block>3');
$request->select('zip');

simple filter
You can also run any simple filters as methods.

$req->service_request_number('11-00026951');

get Response
Response will be return as GuzzleHttp\Message\Response which then can be turned into number of formats

To get JSON from response

$response = $req->get();
$jsonResponse = $response->json();

About

Socrata API Wrapper

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  
  •  

Packages

No packages published

Languages