Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
/ yandex-direct-api Public archive

PHP library for Yandex.Direct API v5 (abandoned)

Notifications You must be signed in to change notification settings

nk2ge5k/yandex-direct-api

Repository files navigation

yandex-direct-api

Offical yandex direct API documentation

Installation

composer require nk2ge5k/yandex-direct-api

Usage

use directapi/DirectApiService;
use directapi/services/campaigns/criterias/CampaignsSelectionCriteria;
use directapi/services/campaigns/enum/CampaignStateEnum;
use directapi/services/campaigns/enum/CampaignFieldEnum;

$token = YOUR_TOKEN;
$login = CLIENT_LOGIN;

$client = new DirectApiService($token, $login);

$campaigns = $client
    ->getCampaignsService()
    ->get(
        new CampaignsSelectionCriteria(
            [   
                'States' => [
                    CampaignStateEnum::ON
                ]   
            ]   
        ),  
        CampaignFieldEnum::getValues()
    );  

foreach ( $campaigns as $campaign ) { 
    // do something
}