From your root directory:
mkdir packages && cd packages
mkdir tkane && cd tkane
mkdir open-states && cd open-states
From the open-states directory, clone this repo:
git clone git@github.com:thomasjohnkane/open-states-api-laravel-package.git
Add you open-states key to your .env file as OPEN_STATES_KEY
Edit composer.json
to reflect the package information. At a minimum, you need to autoload the package and require guzzle.
{
"guzzlehttp/guzzle": "^6.2"
...
"autoload": {
"psr-4": {
"Tkane\\OpenStates\\": "packages/tkane/open-states/src"
}
},
...
},
Tkane\OpenStates\ServiceProvider::class,
'OpenStates' => Tkane\OpenStates\Facade::class,
``
NOTE: http://docs.openstates.org/en/latest/api/
OpenStates::getBills('', [
'state' => $state,
'search_window' => 'session',
'per_page' => 1000,
'page' => $i
]);
Note: The page should increment until no bills are returned. This is because most states have too many bills for a single call.
OpenStates::getBill($bill->os_id);
Note: The $os_id is returned in the bill search query as the ID
OpenStates::getCommittees($state);
OpenStates::getCommittee($committee->os_id);
Note: The $os_id is returned in the committee search query as the ID
OpenStates::getLegislators($state);
- Add publishable config that uses services.php
- Add more detail about how entities relate (committee members, legislators, etc)
- Show more examples of how to use