andylolz/everypolitician-popolo 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

andylolz/everypolitician-popolo

Composer 安装命令:

composer require andylolz/everypolitician-popolo

包简介

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

README 文档

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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.

Install

Via Composer

$ composer require andylolz/everypolitician-popolo

Usage

You can download a Popolo file manually from EveryPolitician.

The following example uses Åland Lagting (which is the legislature of the Åland islands, available as JSON data from the EveryPolitician page for Åland).

First you'll need to require the library and read in a file from disk.

use \EveryPolitician\EveryPoliticianPopolo\Popolo;
$popolo = Popolo::fromFilename('ep-popolo-v1.0.json');

All Popolo classes used by EveryPolitician are implemented:

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

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

You can also find individual records or collections based on their attributes:

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.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固