digtyarenko/osnova-php-sdk

PHP SDK for Osnova API

0.4.1 2021-04-18 10:47 UTC

This package is auto-updated.

Last update: 2024-11-18 18:43:58 UTC


README

Latest Version on Packagist

Требования

Требуется PHP 7.4 или выше.

Установка

С помощью composer:

$ composer require digtyarenko/osnova-php-sdk

Документация

Полная документация доступна здесь.

Пример использования

Лента статей

<?php

use Osnova\Api\DtfApi;
use Osnova\Api\Service\Timeline\Enum\CategoryEnum;
use Osnova\Api\Service\Timeline\Enum\SortingEnum;
use Osnova\Api\Service\Timeline\TimelineService;

$api = DtfApi::init();
$timelineService = $api->getService(TimelineService::class);

$result = $timelineService->getTimeline(
    new CategoryEnum(CategoryEnum::INDEX),
    new SortingEnum(SortingEnum::RECENT)
)->getResult();

Список подсайтов

<?php

use Osnova\Api\DtfApi;
use Osnova\Api\Service\Subsite\Enum\TypeEnum;
use Osnova\Api\Service\Subsite\SubsiteService;

$api = DtfApi::init();
$subsiteService = $api->getService(SubsiteService::class);

$result = $subsiteService->getSubsitesList(new TypeEnum(TypeEnum::SECTIONS))->getResult();

Лента статей подсайта

<?php

use Osnova\Api\DtfApi;
use Osnova\Api\Service\Subsite\Enum\SortingEnum;
use Osnova\Api\Service\Subsite\SubsiteService;

$api = DtfApi::init();
$subsiteService = $api->getService(SubsiteService::class);

$result = $subsiteService->getSubsiteTimeline(
    64953,
    new SortingEnum(SortingEnum::TOP_WEEK)
)->getResult();

Лицензия

The MIT License (MIT). Ознакомьтесь с файлом лицензии для получения более детальной информации.