2017 © Pedro PelĂĄez
 

library swapi

image

rmasters/swapi

  • Tuesday, January 20, 2015
  • by rmasters
  • Repository
  • 2 Watchers
  • 12 Stars
  • 83 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PHP library for SWAPI

Build status Stable release License, (*1)

 Usage

Install with Composer: composer require "rmasters/swapi:~1.0"., (*2)

require_once __DIR__ . '/vendor/autoload.php';
use SWAPI\SWAPI;

$swapi = new SWAPI;

$swapi->characters()->index();  => Character[]
$swapi->characters()->index(2); => Character[]

$swapi->vehicles()->get(1);     => Vehicle <X-wing>
$swapi->planets()->get(7);      => Planet <Mustafar>

$swapi->people()->get(9999);    => null (not-found)

// Iteration
do {
    if (!isset($starships)) {
        $starships = $swapi->starships()->index();
    } else {
        $starships = $starships->getNext();
    }

    foreach ($starships as $s) {
        echo "{$s->name}\n";
    }
} while ($starships->hasNext());

 Running tests and contributing

Install dependencies with composer install --dev and run vendor/bin/phpunit to run the testsuite. The test suite comprises of:, (*3)

License

MIT Licensed, (*4)

The Versions