PHPackages                             seanmcn/php-represent - 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. seanmcn/php-represent

ActiveLibrary[API Development](/categories/api)

seanmcn/php-represent
=====================

A PHP library for http://represent.opennorth.ca/

v2.0(4y ago)0240.7k↑16.3%1GPL-3.0+PHPPHP ^7.2 || ^8.0

Since Apr 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/seanmcn/php-represent)[ Packagist](https://packagist.org/packages/seanmcn/php-represent)[ Docs](https://github.com/seanmcn/php-represent)[ RSS](/packages/seanmcn-php-represent/feed)WikiDiscussions master Synced 1mo ago

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

PHP Represent
=============

[](#php-represent)

[![Latest Stable Version](https://camo.githubusercontent.com/48b35286b3ea38a3512b82d2f5fdd00bcde83531ce483ffbb8203b51eb54a38f/68747470733a2f2f706f7365722e707567782e6f72672f7365616e6d636e2f7068702d726570726573656e742f762f737461626c65)](https://packagist.org/packages/seanmcn/php-represent) [![Total Downloads](https://camo.githubusercontent.com/27b7712699ee38165d7155908bc9c01ef6b00d26a3e76bd74b25292eb79bd5e9/68747470733a2f2f706f7365722e707567782e6f72672f7365616e6d636e2f7068702d726570726573656e742f646f776e6c6f616473)](https://packagist.org/packages/seanmcn/php-represent) [![Latest Unstable Version](https://camo.githubusercontent.com/2bdb06147f16885d38ff9529c8abdab91314b7330402935b9b62ab138dc985f9/68747470733a2f2f706f7365722e707567782e6f72672f7365616e6d636e2f7068702d726570726573656e742f762f756e737461626c65)](https://packagist.org/packages/seanmcn/php-represent) [![License](https://camo.githubusercontent.com/ac28f990cc26d9339defe3f73481f5cfe0fba192d9d548c73e4a7091f0cc013e/68747470733a2f2f706f7365722e707567782e6f72672f7365616e6d636e2f7068702d726570726573656e742f6c6963656e7365)](https://packagist.org/packages/seanmcn/php-represent)

A PHP library for

> Find the elected officials and electoral districts for any Canadian address or postal code, at all levels of government

Install
-------

[](#install)

Install using composer:

```
"require": {
  "seanmcn/php-represent": "1.*"
}

```

Alternatively you could just download the package and load it in yourself.

Example Usage
-------------

[](#example-usage)

```
$represent = new PHPRepresent\API();
$represent->getAll('boundaries', ['sets' => ['toronto-wards', 'ottawa-wards']]);

```

API Documentation
-----------------

[](#api-documentation)

- [Represent Civic Information API Documentation](http://represent.opennorth.ca/api/)

Library Documentation
---------------------

[](#library-documentation)

### get($path, $params, $throttle);

[](#getpath-params-throttle)

Returns a single result or one page of results from API path and parameters provided.

**Parameters**:

- `$path` - The API Path of your request.
- `$params` - $\_GET variables you want to append to the request. Allows supplying multiple values per key by array or comma seperated.
- `$throttle` - Default TRUE. Option to ignore the API rate limit.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$path = 'boundaries';
$params = ['sets' => ['toronto-wards', 'ottawa-wards']];
$represent->get($path, $params);
```

### getAll($path, $params);

[](#getallpath-params)

Returns all results from API path and parameters provided.

**Parameters**:

- `$path` - The API Path of your request.
- `$params` - $\_GET variables you want to append to the request. Allows supplying multiple values per key by array or comma seperated.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$path = 'boundaries';
$params = ['sets' => 'toronto-wards,ottawa-wards'];
$represent->getAll($path, $params);
```

### postcode($postcode);

[](#postcodepostcode)

Find representatives and boundaries by postal code.

**Parameters**:

- `$postcode` - Post code to find representatives and boundaries for.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->postcode('L5G4L3');
```

### boundarySets($name, $params);

[](#boundarysetsname-params)

Return boundary sets which are groups of electoral districts, like BC provincial districts or Toronto wards.

**Parameters**:

- `$name` - Optional, if provided will return the singular boundary set.
- `$params` - $\_GET variables you want to append to the request. Allows supplying multiple values per key by array or comma seperated.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->boundarySets();
```

### boundaries($boundarySet, $name, $representatives, $params)

[](#boundariesboundaryset-name-representatives-params)

Return boundaries of electoral districts, can be proved a set like `toronto-wards` for boundaries of a singular set.

> All Parameters are optional however `$name` requires you provide `$boundarySet` and `$representatives` requires you provided both `$boundarySet` and `$name`

**Parameters**:

- `$boundarySet` - Optional, if provided returns boundaries from a singular boundary set
- `$name` - Optional, if provided will return a singular boundary
- `$representatives` - Optional, if provided will return representatives for the boundary.
- `$params` - Optional, $\_GET variables you want to append to the request. Allows supplying multiple values per key by array or comma seperated.

**Example Usage:**

```
$represent = new PHPRepresent\API();
// One Set
$represent->boundaries('toronto-wards');
// Multiple Sets
$represent->boundaries(null, null, false,  ['sets' => ['toronto-wards', 'ottawa-wards']]);
```

### representativeSets($set);

[](#representativesetsset)

Returns all or a singular representative set.

> A representative set is a group of elected officials, like the House of Commons or Toronto City Council.

**Parameters**:

- `$set` - Optional, if provided will return the singular represenative set.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->representativeSets('north-dumfries-township-council');
```

### representatives($set, $params);

[](#representativesset-params)

Returns a list of representatives.

**Parameters**:

- `$set` - Optional, if provided will return the represenatives for a singular set.
- `$params` - Optional, `$_GET` variables you want to append to the request. Allows supplying multiple values per key by array or comma seperated.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->representatives('house-of-commons');
```

### elections($election);

[](#electionselection)

Returns a list of elections or a singular election.

> **This doesn't have any data right now so I am usnure if this is working correctly.**

**Parameters**:

- `$election` - Optional, if provided will return the a singular election based on provided ID.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->elections();
```

### candidates($election, $params);

[](#candidateselection-params)

Returns a list of all candidates for all elections or all candidates for a singular election

> **This doesn't have any data right now so I am unsure if this is working correctly.**

**Parameters**:

- `$election` - Optional, if provided will return the candidates for a singular election.
- `$params` - Optional, `$_GET` variables you want to append to the request. Allows supplying multiple values per key by array or comma seperated.

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->candidates();
```

### setInsecure();

[](#setinsecure)

Option to disable using HTTPS, if for example you are having certificate problems while testing this out.

> Note: You really shouldn't use this in Production

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->setInsecure();
$represent->boundaries('toronto-wards');
```

### setRateLimit($limit);

[](#setratelimitlimit)

Option to set the rate limit (per minute) to whatever you choose. The default rate limit is 60 requests per minute.

> Note: Don't change this unless you have agreed upon a higher rate limit with [Open North](mailto:represent@opennorth.ca) otherwise you're going to get HTTP 503 errors

**Example Usage:**

```
$represent = new PHPRepresent\API();
$represent->setRateLimit(42);
$represent->boundaries('ottawa-wards');
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 78.3% of commits — single point of failure

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 ~2076 days

Total

2

Last Release

1618d ago

Major Versions

v1.0 → v2.02021-12-12

PHP version history (2 changes)v1.0PHP ^5.4|^7.0

v2.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/94ac0ec318be353da4f3451693838d0bd64c86cf8b3aa242d2314e574d169a39?d=identicon)[Seanmcn](/maintainers/Seanmcn)

---

Top Contributors

[![seanmcn](https://avatars.githubusercontent.com/u/1639126?v=4)](https://github.com/seanmcn "seanmcn (18 commits)")[![johnpbloch](https://avatars.githubusercontent.com/u/446833?v=4)](https://github.com/johnpbloch "johnpbloch (5 commits)")

---

Tags

phpapilibraryrepresentcanadaopennorthpolitics

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/seanmcn-php-represent/health.svg)

```
[![Health](https://phpackages.com/badges/seanmcn-php-represent/health.svg)](https://phpackages.com/packages/seanmcn-php-represent)
```

###  Alternatives

[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[getjump/vk

Library for work with API Vk.com

19948.5k](/packages/getjump-vk)[mikealmond/musicbrainz

A PHP library for accessing the MusicBrainz API

6385.1k1](/packages/mikealmond-musicbrainz)

PHPackages © 2026

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