Skip to content

Offline mode usage

Junaid Atari edited this page Apr 9, 2016 · 1 revision
// Uncomment to set mode as offline
// defined('YII2CDN_OFFLINE') or define('YII2CDN_OFFLINE', true);

// ================== Offline ======================

/** Example 1: (offline) */
if ( !\yii2cdn\Cdn::isOnline() ) {
	// some logic goes here
}

/** Example 2: (offline event) */
\Yii::$app->cdn->whenOffline (function ($cdn) {
	/** @var \yii2cdn\Cdn $cdn */
    // some logic goes here
});

// ================== Online ======================

/** Example 1: (online) */
if ( \yii2cdn\Cdn::isOnline() ) {
	// some logic goes here
}

/** Example 2: (online event) */
\Yii::$app->cdn->whenOnline (function ($cdn) {
	/** @var \yii2cdn\Cdn $cdn */
    // some logic goes here
});

Note: the red links below are pages yet to be created. Feel free to add them!

Overview documents

  • README: distributed with yii2cdn, contains a quick overview of yii2cdn's functionality, an example, and the license.
  • REFERENCE: Containing incomplete api class reference.

Quick Start

Configuration

Tutorials

Clone this wiki locally