PHPackages                             andrewdanilov/yii2-context - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. andrewdanilov/yii2-context

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

andrewdanilov/yii2-context
==========================

Widgets for context advertising

1.0.7(3y ago)133MITPHPPHP &gt;=5.6.0

Since May 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/AndrewDanilov/yii2-context)[ Packagist](https://packagist.org/packages/andrewdanilov/yii2-context)[ RSS](/packages/andrewdanilov-yii2-context/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (9)Used By (0)

Yii2 context ad
===============

[](#yii2-context-ad)

Widgets for context advertising

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require andrewdanilov/yii2-context "~1.0.0"

```

or add

```
"andrewdanilov/yii2-context": "~1.0.0"

```

to the `require` section of your `composer.json` file.

Usage
=====

[](#usage)

Google Adsense
--------------

[](#google-adsense)

Create ad blocks in google adsense control panel. Get data-ad-client and data-ad-slot from block code for each block. Call widget in your View.

```

```

Property `client` is usually the same for all ad blocks. To set it once for all widget instances, you can define it in DI container config.

```
return [
	// ...
	'container' => [
		'definitions' => [
			'andrewdanilov\context\adsense\Adsense' => [
				'client' => 'ca-pub-1234567890123456',
			],
		],
	],
	// ...
];
```

Yandex Partner
--------------

[](#yandex-partner)

Call widget in your view

```
