定制 andylolz/everypolitician 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

andylolz/everypolitician

Composer 安装命令:

composer require andylolz/everypolitician

包简介

PHP package for easy access to EveryPolitician data

关键字:

README 文档

README

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

A PHP library for easy access to EveryPolitician data. This is essentially a port of everypolitician-python, which is itself a port of everypolitican-ruby.

Install

Via Composer

$ composer require andylolz/everypolitician

Usage

Creating an instance of the EveryPolitican class allows you to access information on countries, their legislatures and legislative periods. Each country and legislature has a slug that can be used to reference them via the country and legislature methods:

use \EveryPolitician\EveryPolitician\EveryPolitician;
$ep = new EveryPolitician();

$australia = $ep->country('Australia');
$senate = $australia->legislature('Senate');
echo (string) $senate; // <Legislature: Senate in Australia>

$uk = $ep->country('UK');
$houseOfCommons = $uk->legislature('Commons');

$americanSamoa = $ep->country('American-Samoa');
$houseOfRepresentatives = $americanSamoa->legislature('House');

foreach ($ep->countries() as $country) {
    echo $country->name.' has '.count($country->legislatures()).'legislatures';
}

By default this will get the EveryPolitician data and returns the most recent data. This data is found from the index file, called countries.json, which links to specific versions of other data files.

If you want want to point to a different countries.json file, you can override the default URL using ::fromUrl:

$ep = EveryPolitician::fromUrl('https://cdn.rawgit.com/everypolitician/everypolitician-data/080cb46/countries.json');

The example above is using a specific commit (indicated by the hash 080cb46). If you want to use a local copy of countries.json you can instead create the object using the ::fromFilename method, e.g.:

$ep = EveryPolitician::fromFilename('/home/andy/tmp/countries.json');

For more about countries.json, see this description.

Remember that EveryPolitician data is frequently updated — see this information about using EveryPolitician data.

More information on the EveryPolitician site.

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.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固