PHP code example of consultnn / abstract-client

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

    

consultnn / abstract-client example snippets


/**
 * Class Company
 * @package consultnn\api
 */
class PageDomain extends \consultnn\baseapi\AbstractDomain
{
    public function init()
    {
        //базовый путь для запросов вида http://api.example.com/<version>/<endpoint>
        $this->client->url = 'http://api.example.com';
    }

    public function getBySlug($slug, $type = null)
    {
        return $this->getSingle(
            'page/' . $slug,
            Page::class,
            [
                'attribute' => 'slug',
                'type' => $type
            ]
        );
    }

    public function getList($queryParams) {
        return $this->getInternalList('page', Page::class, $queryParams)
    }
}