PHP code example of endeavour / groeigids-api-client

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

    

endeavour / groeigids-api-client example snippets


use Endeavour\GroeigidsApiClient\Infrastructure\HttpClient\GroeigidsClient;

$client = new GroeigidsClient(
    ClientInterface,
    RequestFactoryInterface,
    new ResponseDataBuilder(),
    new ResponseValidator(new Opis\Validator()),
    getenv('GROEIGIDS_API_KEY')
);

$articles = $client->fetchArticles();
$themes = $client->fetchThemeArticles();

$articles = $client->fetchArticles(page: 1, size: 10);
$themes = $client->fetchThemeArticles(page: 2, size: 50);

$sortParameters = new TypedArray(SortParameter::class, [
    new SortParameter('title', 'asc'),
    new SortParameter('order', 'desc')
]);
$articles = $client->fetchArticles(sort: $sortParameters);

$articleById = $client->fetchArticle(1);
$articleByBreadcrumb = $client->fetchArticleByBreadcrumb('article-breadcrumb');
$articlesAfterDate = $client->fetchModfifiedArticlesAfterDate(new DateTime('2020-01-01'))