PHP code example of phpmv / php-mv-ui

1. Go to this page and download the library: Download phpmv/php-mv-ui 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/ */

    

phpmv / php-mv-ui example snippets




	"di"=>array(
			"@exec"=>array("jquery"=>function ($controller){
						return \Ajax\php\ubiquity\JsUtils::diSemantic($controller);
					})
			),

/**
 * @property \Ajax\php\ubiquity\JsUtils $jquery
 */
class ExempleController extends Controller{
	public function index(){
		$semantic=$this->jquery->semantic();
		$button=$semantic->htmlButton("btTest","Test Button");
		echo $button;
	}
}

$loader = new \Phalcon\Loader();
$loader->registerNamespaces(array(
		'Ajax' => __DIR__ . '/../vendor/phpmv/php-mv-ui/Ajax/'
))->register();

$di->set("jquery",function(){
    $jquery= new Ajax\php\phalcon\JsUtils();
    $jquery->semantic(new Ajax\Semantic());//for Semantic UI
    return $jquery;
});

use Phalcon\Mvc\Controller;
use Ajax\php\phalcon\JsUtils;
/**
 * @property JsUtils $jquery
 */
class ExempleController extends Controller{
	public function indexAction(){
		$semantic=$this->jquery->semantic();
		$button=$semantic->htmlButton("btTest","Test Button");
		echo $button;
	}
}

use Ajax\php\ci\JsUtils;
class XsUtils extends Ajax\php\ci\JsUtils{
	public function __construct(){
		parent::__construct(["semantic"=>true,"debug"=>false]);
	}
}

$autoload['libraries'] = array('XsUtils' => 'jquery');

$this->jquery->some_method();

$app->singleton(Ajax\php\laravel\JsUtils::class, function($app){
	$result= new Ajax\php\laravel\JsUtils();
	$result->semantic(new Ajax\Semantic());
	return $result;
});

use Ajax\php\laravel\JsUtils;
class Controller extends BaseController{
    use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
    protected $jquery;

    public function __construct(JsUtils $js){
    	$this->jquery = $js;
    }

    public function getJquery() {
    	return $this->jquery;
    }
}



\Yii::$container->setSingleton("Ajax\php\yii\JsUtils",["bootstrap"=>new Ajax\Semantic()]);

namespace app\controllers;

use yii\web\Controller;
use Ajax\php\yii\JsUtils;

class SiteController extends Controller{
	protected $jquery;

	public function __construct($id, $module,JsUtils $js){
		parent::__construct($id, $module);
		$this->jquery=$js;
	}
}

use Symfony\Component\ClassLoader\Psr4ClassLoader;

x('Ajax\\', __DIR__.'/lib/phpmv/php-mv-ui/Ajax');
$loader->register();

namespace App\Services\semantic;

use Ajax\php\symfony\JquerySemantic;

class SemanticGui extends JquerySemantic{
}

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use App\Services\semantic\SemanticGui;

BarController extends AbstractController{
	/**
	 * @var SemanticGui
	 */
	protected $gui;

    public function loadViewWithAjaxButtonAction(){
    	$bt=$this->gui->semantic()->htmlButton('button1','a button');
    	$bt->getOnClick("/url",'#responseElement');
    	return $this->gui->renderView("barView.html.twig");
    }
}

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Ajax\php\symfony\JsUtils;
use AppBundle\AppBundle;

/**
 * @Route(service="app.default_controller")
 */
class DefaultController extends Controller{
	/**
	 * @var Ajax\php\symfony\JsUtils
	 */
	protected $jquery;

	public function __construct(ContainerInterface $container,JsUtils $js){
		$this->container=$container;
		$this->jquery= $js;
	}
}

    public function initialize(){
        parent::initialize();

        $this->loadComponent('RequestHandler');
        $this->loadComponent('Flash');
        $this->loadComponent('JsUtils',["semantic"=>true]);
    }

/**
  * @property Ajax\JsUtils $jquery
  */
class MyController{
}
bash
php composer.phar install
json
"autoload": {
    "classmap": [
        ...
    ],
    "psr-4": {
        "Ajax\\": "vendor/phpmv/php-mv-ui/Ajax"
    }
},