PHP code example of andylolz / everypolitician-popolo

1. Go to this page and download the library: Download andylolz/everypolitician-popolo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andylolz / everypolitician-popolo example snippets

 php
count($popolo->persons); // 60
$person = $popolo->persons->first;
echo $person->id; // e3aab23e-a883-4763-be0d-92e5936024e2
echo $person->name; // Aaltonen Carina
echo $person->image; // http://www.lagtinget.ax/files/aaltonen_carina.jpg
echo $person->wikidata; // Q4934081
 php
echo $popolo->persons->get(["name" => "Aaltonen Carina"]); // <Person: Aaltonen Carina>

$organizations = $popolo->organizations->filter(["classification" => "party"]);
foreach ($organizations as $organization) {
    echo $organization;
}
// <Organization: Liberalerna>
// <Organization: Liberalerna på Åland r.f.>
// <Organization: Moderat Samling>
// <Organization: Moderat Samling på Åland r.f.>
// <Organization: Moderat samling>
// <Organization: Moderaterna på Åland>
// <Organization: Obunden Samling>
// <Organization: Obunden Samling på Åland>
// <Organization: Ålands Framtid>
// <Organization: Ålands Socialdemokrater>
// <Organization: Ålands framtid>
// <Organization: Ålands socialdemokrater>
// <Organization: Åländsk Center>
// <Organization: Åländsk Center r.f.>
// <Organization: Åländsk Demokrati>
// <Organization: Åländsk center>