A Laravel 5 PHP Client for our Civil Services API Edit

v0.2.0 2017-03-30 00:42 UTC

This package is not auto-updated.

Last update: 2020-07-30 23:21:34 UTC


Civil Services Logo

Civil Services is a collection of tools that make it possible for citizens to be a part of what is happening in their Local, State & Federal Governments.

API Client for Laravel 5

Latest Version on Packagist Total Downloads GitHub license GitHub contributors


This is an API Client for our Civil Services API. Please see our API Documentation for details on what options are available for Each Endpoint.


Step 1: Install Through Composer

Our Service Provider can be installed via Composer by either installing through composer:

composer require civilservices/api-client-laravel

or requiring the civilservices/api-client-laravel package in your project's composer.json.

    "require": {
        "civilservices/api-client-laravel": "~1.0"

Then run a composer update:

composer update

Step 2: Add the Service Provider

Add the service provider in app/config/app.php

'providers' => array(
    // ...

Step 3: Add the Facade

Add the alias in app/config/app.php

'aliases' => [
    // ...
    'CivilServices' => CivilServices\Api\Facades\CivilServices::class,


By default, the package uses the following environment variables to auto-configure the plugin without modification:


To customize the configuration file, publish the package configuration using Artisan.

php artisan vendor:publish --provider="CivilServices\Api\ApiServiceProvider"

Update your settings in the generated app/config/civilservices.php configuration file.

return [
    'api_base' => env('CIVIL_SERVICES_API_BASE', ''),
    'api_key' => env('CIVIL_SERVICES_API_KEY', 'YOUR_API_KEY'),
    'api_version' => env('CIVIL_SERVICES_API_VERSION', 'v1'),
    'cache_expire' => env('CIVIL_SERVICES_CACHE_EXPIRE', 3600),

If you need an API Key, you can request one here:

Examples & API Doc Links

City Council

use CivilServices;

// Get City Council for the city and state of New York, NY
$city_council = CivilServices::getCityCouncil('NY', 'New York');

// Search all City Council's in the USA for Female African American's
$city_council = CivilServices::searchCityCouncil([
    'gender' => 'female', 
    'ethnicity' => 'african-american'


 use CivilServices;
// Get Geolocation Data for Zip Code 10004
 $zipcode = CivilServices::getGeolocationZipcode('10004');
// Get Geolocation Data for IP Address
$ipaddress = CivilServices::getGeolocationIP('');

// Search all Geolocation Data in the USA with a minimum population of 1,000,000 people
$geolocation = CivilServices::searchGeolocation([
    'minPopulation' => 1000000


use CivilServices;

// Get Government Data for Specific GPS Location
$geolocation = CivilServices::searchGovernment([
    'latitude' => 27.782805,
    'longitude' => -82.63314


use CivilServices;

// Search all House of Representatives's for Female African American's
$house = CivilServices::searchHouse([
    'gender' => 'female',
    'ethnicity' => 'african-american'


use CivilServices;

// Get Legislators for Specific GPS Location
$legislators = CivilServices::searchLegislators([
    'latitude' => 27.782805,
    'longitude' => -82.63314


use CivilServices;

// Search all Senators's for Female African American's
$senate = CivilServices::searchSenate([
    'gender' => 'female',
    'ethnicity' => 'african-american'


use CivilServices;

// Get information about New York
$state = CivilServices::getState('NY');

// Search all US States with a minimum population of 1,000,000 people
$state = CivilServices::searchStates([
    'minPopulation' => 1000000


Run the tests with: