Skip to content

Repository files navigation

PHP library for SWAPI

Build statusStable releaseLicense

## Usage

Install with Composer: composer require "rmasters/swapi:~1.0".

require_once__DIR__ . '/vendor/autoload.php';
useSWAPI\SWAPI;
$swapi = newSWAPI;
$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)
// Iterationdo {
if (!isset($starships)) {
$starships = $swapi->starships()->index();
} else {
$starships = $starships->getNext();
}
foreach ($starshipsas$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:

License

MIT Licensed

About

PHP wrapper library for SWAPI

Resources

Stars

21 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages