freinir / ad-wizard
Package for generate Yandex RTB blocks and google ads for desktop and mobile version
1.9
2026-03-18 15:51 UTC
Requires
- php: >=7.1.0
- mobiledetect/mobiledetectlib: ^2.8
README
This README would normally document whatever steps are necessary to get your application up and running.
About
This library provides an interface for rendering different ads for mobile versions and desktops.
Installation
Install the package via Composer
composer require freinir/ad-wizard
Basic usage
$yandexAd = new AdYandex('R-XXX-XX')
Insert into your views
Render RTB block for desktop and tablets only:
<?=$yandexAd->getDesktop(1, 'My first RTB block', 'adv__custom')?>
Render RTB block for mobile devices only:
<?=$yandexAd->getMobile(2, 'My mobile RTB block', 'adv__mobile')?>
Render different blocks for desktop and mobile (desktop id 1, mobile id 2):
<?=$yandexAd->getDesktopOrMobile(1, 2, 'Desktop or mobile RTB block')?>
Render one block for all screen sizes:
<?=$yandexAd->getAllSize(3, 'All size RTB block', 'adv__all')?>
Render sticky block (bottom mobile banner):
<?=$yandexAd->getMobileSticky(4, 'Sticky mobile RTB block')?>
Render fullscreen interstitial for mobile:
<?=$yandexAd->getMobileFullscreen(5)?>
Render fullscreen interstitial for desktop:
<?=$yandexAd->getDesktopFullscreen(6)?>