PHP code example of skillshare / apollo-federation-php
1. Go to this page and download the library: Download skillshare/apollo-federation-php 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/ */
skillshare / apollo-federation-php example snippets
use Apollo\Federation\Types\EntityObjectType;
$userType = new EntityObjectType([
'name' => 'User',
'keyFields' => ['id', 'email'],
'fields' => [
'id' => ['type' => Type::int()],
'email' => ['type' => Type::string()],
'firstName' => ['type' => Type::string()],
'lastName' => ['type' => Type::string()]
],
'__resolveReference' => static function ($ref) {
// .. fetch from a data source.
}
]);