PHP code example of carono / yii2-giix

1. Go to this page and download the library: Download carono/yii2-giix 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/ */

    

carono / yii2-giix example snippets


 'controllerMap' => [
        'giix' => [
            'class' => 'carono\giix\GiixController',
            'templatePath' => '@app/templates/model',
            'generator' => [
                'class' => 'carono\giix\generators\model\Generator'
            ]
        ],
    ],



namespace app\templates\model;

use carono\codegen\ClassGenerator;
use Nette\PhpGenerator\Method;

class Finder extends ClassGenerator
{
    protected function formExtends()
    {
        return 'yii\base\Model';
    }

    protected function formClassNamespace()
    {
        return 'app\models\finders';
    }

    protected function formClassName()
    {
        return $this->params['className'] . 'Finder';
    }

    protected function formOutputPath()
    {
        return \Yii::getAlias('@app/models/finders/' . $this->formClassName() . '.php');
    }

    /**
     * @param Method $method
     */
    public function myFunction($method)
    {
        $method->addParameter('param');
        $method->addBody('echo "Hello World";');
    }
}



/**
 * This class is generated using the package carono/codegen
 */

namespace app\models\finders;

class UserFinder extends \yii\base\Model
{
	public function myFunction($param)
	{
		echo "Hello World";
	}
}