PHP code example of winternet-studio / yii2-wordpress-glue

1. Go to this page and download the library: Download winternet-studio/yii2-wordpress-glue library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

winternet-studio / yii2-wordpress-glue example snippets



// wp-content/plugins/awesome-plugin/awesome-plugin.php

use winternet\yii2wordpress\KernelRunner;

odels\MyModel
	],
	'language' => 'en-US',
	'components' => [
		'cache' => [
			'class' => 'yii\caching\FileCache',
			'defaultDuration' => 600,
		],
		'i18n' => [
			'translations' => [
				'myApp*' => [
					'class' => 'yii\i18n\PhpMessageSource',
					'forceTranslation' => true,
					'basePath' => dirname(__DIR__) . '/messages',
				],
			],
		],
	],
];

$isDebug = true;  //set true during development
$kernel = new KernelRunner($config, null, $isDebug);
$kernel->run();


class m191119_103515_createTables extends \yii\db\Migration {
	/**
	 * {@inheritdoc}
	 */
	public function safeUp() {
		$this->createTable(
			'{{%mymodule_mytable}}',
			array_merge(\winternet\yii2wordpress\helpers\MigrationHelper::getSystemCols(), [
				'foo' => $this->text(),
				'bar' => $this->string(10)
			])
		);
	}
}