PHP code example of sdkfabric / starwars

1. Go to this page and download the library: Download sdkfabric/starwars 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/ */

    

sdkfabric / starwars example snippets




nt = new \SdkFabric\Starwars\Client::build('[access_token]');

// Get all the people.
$response = $client->people()->getAll('search');

// Get a specific people.
$response = $client->people()->get('id');

// Get all the films.
$response = $client->film()->getAll('search');

// Get a specific film.
$response = $client->film()->get('id');

// Get all the starships.
$response = $client->starship()->getAll('search');

// Get a specific starship.
$response = $client->starship()->get('id');

// Get all the species.
$response = $client->species()->getAll('search');

// Get a specific species.
$response = $client->species()->get('id');

// Get all the vehicles.
$response = $client->vehicle()->getAll('search');

// Get a specific vehicle.
$response = $client->vehicle()->get('id');

// Get all the planets.
$response = $client->planet()->getAll('search');

// Get a specific planet.
$response = $client->planet()->get('id');