2017 © Pedro PelĂĄez
 

library everypolitician-popolo

Parse EveryPolitician-flavoured Popolo data, and navigate it with PHP

image

andylolz/everypolitician-popolo

Parse EveryPolitician-flavoured Popolo data, and navigate it with PHP

  • Wednesday, December 14, 2016
  • by andylolz
  • Repository
  • 2 Watchers
  • 1 Stars
  • 102 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 3 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

everypolitician-popolo for PHP

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score ![Total Downloads][ico-downloads], (*1)

This is a port of the Python package everypolitician-popolo-python to PHP, which itself is a port of the Ruby gem everypolitician-popolo to Python., (*2)

Install

Via Composer, (*3)

``` bash $ composer require andylolz/everypolitician-popolo, (*4)


## Usage You can download a Popolo file manually from [EveryPolitician](http://everypolitician.org/). The following example uses [Åland Lagting](https://github.com/everypolitician/everypolitician-data/raw/master/data/Aland/Lagting/ep-popolo-v1.0.json) (which is the legislature of the Åland islands, available as JSON data from the [EveryPolitician page for Åland](http://everypolitician.org/aland/)). First you'll need to require the library and read in a file from disk. ``` php use \EveryPolitician\EveryPoliticianPopolo\Popolo; $popolo = Popolo::fromFilename('ep-popolo-v1.0.json');

All Popolo classes used by EveryPolitician are implemented:, (*5)

There are methods defined for each property on a class, e.g. for a Person:, (*6)

``` php count($popolo->persons); // 60 $person = $popolo->persons->first; echo $person->id; // e3aab23e-a883-4763-be0d-92e5936024e2 echo $person->name; // Aaltonen Carina echo $person->image; // http://www.lagtinget.ax/files/aaltonen_carina.jpg echo $person->wikidata; // Q4934081, (*7)


You can also find individual records or collections based on their attributes: ``` php echo $popolo->persons->get(["name" => "Aaltonen Carina"]); // <Person: Aaltonen Carina> $organizations = $popolo->organizations->filter(["classification" => "party"]); foreach ($organizations as $organization) { echo $organization; } // <Organization: Liberalerna> // <Organization: Liberalerna pĂ„ Åland r.f.> // <Organization: Moderat Samling> // <Organization: Moderat Samling pĂ„ Åland r.f.> // <Organization: Moderat samling> // <Organization: Moderaterna pĂ„ Åland> // <Organization: Obunden Samling> // <Organization: Obunden Samling pĂ„ Åland> // <Organization: Ålands Framtid> // <Organization: Ålands Socialdemokrater> // <Organization: Ålands framtid> // <Organization: Ålands socialdemokrater> // <Organization: ÅlĂ€ndsk Center> // <Organization: ÅlĂ€ndsk Center r.f.> // <Organization: ÅlĂ€ndsk Demokrati> // <Organization: ÅlĂ€ndsk center>

Change log

Please see CHANGELOG for information on what has changed recently., (*8)

Testing

bash $ composer test, (*9)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*10)

Credits

License

The MIT License (MIT). Please see License File for more information., (*11)

The Versions

14/12 2016

dev-master

9999999-dev https://github.com/andylolz/everypolitician-popolo-php

Parse EveryPolitician-flavoured Popolo data, and navigate it with PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

everypolitician popolo

13/12 2016

0.0.3

0.0.3.0 https://github.com/andylolz/everypolitician-popolo-php

Parse Popolo JSON data and navigate it with PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

everypolitician popolo

12/12 2016

0.0.2

0.0.2.0 https://github.com/andylolz/everypolitician-popolo-php

Parse Popolo JSON data and navigate it with PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

everypolitician popolo

12/12 2016

0.0.1

0.0.1.0 https://github.com/andylolz/everypolitician-popolo-php

Parse Popolo JSON data and navigate it with PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

everypolitician popolo