PHPackages                             andylolz/everypolitician - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. andylolz/everypolitician

ActiveLibrary[API Development](/categories/api)

andylolz/everypolitician
========================

PHP package for easy access to EveryPolitician data

0.0.2(9y ago)334MITPHP ~5.6|~7.0

Since Dec 13Compare

[ Source](https://github.com/andylolz/everypolitician-php)[ Packagist](https://packagist.org/packages/andylolz/everypolitician)[ Docs](https://github.com/andylolz/everypolitician-php)[ RSS](/packages/andylolz-everypolitician/feed)WikiDiscussions Synced yesterday

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

everypolitician-php
===================

[](#everypolitician-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/03b9c9155d9c87b122a2b14acc0f63bbc49b933d5c0948248e3f52ba08ef3171/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e64796c6f6c7a2f6576657279706f6c6974696369616e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andylolz/everypolitician)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/09ff0de60902826816ad0256a910f0b2852851ad8510506d4e546fe724c79965/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616e64796c6f6c7a2f6576657279706f6c6974696369616e2d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/andylolz/everypolitician-php)[![Coverage Status](https://camo.githubusercontent.com/f7da3f80fe6d62a1818a98f1ca6a6288939ed8d1347fb077cc97727def3a26e2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f616e64796c6f6c7a2f6576657279706f6c6974696369616e2d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/andylolz/everypolitician-php/code-structure)[![Quality Score](https://camo.githubusercontent.com/0fe6e79680dae7938af0b6059a9fa1ef7e48071c362fdc29eda49a64aa7e252d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616e64796c6f6c7a2f6576657279706f6c6974696369616e2d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/andylolz/everypolitician-php)[![Total Downloads](https://camo.githubusercontent.com/a5d623a9464f0b2a27d3f92e81799ab244d6752628eaa8e46b2b71b8957ead22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e64796c6f6c7a2f6576657279706f6c6974696369616e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andylolz/everypolitician)

A PHP library for easy access to EveryPolitician data. This is essentially a port of [everypolitician-python](https://github.com/everypolitician/everypolitician-python), which is itself a port of [everypolitican-ruby](https://github.com/everypolitician/everypolitician-ruby).

Install
-------

[](#install)

Via Composer

```
$ composer require andylolz/everypolitician
```

Usage
-----

[](#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; //

$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](http://docs.everypolitician.org/repo_structure.html).

Remember that EveryPolitician data is frequently updated — see this information about [using EveryPolitician data](http://docs.everypolitician.org/use_the_data.html).

More information on [the EveryPolitician site](http://docs.everypolitician.org/).

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Credits
-------

[](#credits)

- [All Contributors](https://github.com/andylolz/everypolitician-php/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3486d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/464193?v=4)[Andy Lulham](/maintainers/andylolz)[@andylolz](https://github.com/andylolz)

---

Tags

everypolitician

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/andylolz-everypolitician/health.svg)

```
[![Health](https://phpackages.com/badges/andylolz-everypolitician/health.svg)](https://phpackages.com/packages/andylolz-everypolitician)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M932](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k34](/packages/neuron-core-neuron-ai)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751284.3k37](/packages/civicrm-civicrm-core)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
