PHP code example of phramework / jsonapi-client

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

    

phramework / jsonapi-client example snippets



/**
 * Define an API endpoint
 */
$endpoint = (new Endpoint('article'))
    ->setUrl('http://localhost:8005/article/');

/**
 * Get a collection of all `article`s, including their author
 */
$response = $endpoint->get(
    new IncludeRelationship('author')
);

/*
 * Display article collection
 */
print_r($articles = $response->getData());