Download the PHP package phpmv/php-mv-ui without Composer
On this page you can find all versions of the php package phpmv/php-mv-ui. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpmv/php-mv-ui
More information about phpmv/php-mv-ui
Files in phpmv/php-mv-ui
Package php-mv-ui
Short Description A JQuery and UI library for php and php MVC frameworks
License Apache-2.0
Informations about the package php-mv-ui
Visual components library (JQuery UI, Twitter Bootstrap, Semantic-UI) for php and php MVC frameworks
What's phpMv-UI ?
phpMv-UI is a visual components library for php : a php wrapper for jQuery and UI components (jQuery, Twitter Bootstrap, Semantic-UI).
Using the dependency injection, the jQuery object can be injected into php framework container, allowing for the generation of jQuery scripts in controllers, respecting the MVC design pattern.
Requirements/Dependencies
- PHP >= 7.0
- JQuery >= 2.0.3
- JQuery UI >= 1.10 [optional]
- Twitter Bootstrap >= 3.3.2 [optional]
- Semantic-UI >= 2.2 or Fomantic-UI >= 2.7 [optional]
Resources
I - Installation
Installing via Composer
Install Composer in a common location or in your project:
Create the composer.json file in the app directory as follows:
In the app directory, run the composer installer :
Installing via Github
Just clone the repository in a common location or inside your project:
II PHP frameworks configuration
Library loading
phpMv-UI complies with PSR-4 recommendations for auto-loading classes. Whatever the php framework used, with "composer", it is enough to integrate the Composer autoload file.
Ubiquity configuration
Library loading
The library is already loaded by default in the config file app/config/config.php :
Use in controllers
Example of creating a Semantic-UI button
Phalcon configuration
Library loading
Without Composer, It is possible to load the library with the app/config/loader.php file :
Injection of the service
It is necessary to inject the JQuery service at application startup, in the service file app/config/services.php, and if necessary instantiate Semantic, Bootstrap or Jquery-ui :
Use in controllers
Example of creating a Semantic-UI button
CodeIgniter configuration
Library loading
If you want CodeIgniter to use a Composer auto-loader, just set $config['composer_autoload']
to TRUE
or a custom path in application/config/config.php.
Then, it's necessary to create a library for the JsUtils class
Library creation
Create the library XsUtils (the name is free) in the folder application/libraries
Injection of the service
Add the loading of the XsUtils library in the file application/config/autoload.php
The jquery member will be accessible in the controllers
Once loaded you can access your class in controllers using the $jquery member:
Laravel configuration
Library loading
If you do not use the Composer autoloader file, you can also load phpMv-UI with composer.json :
Injection of the service
Register a Singleton in bootstrap/app.php file :
Then it is possible to inject the JsUtils class in the base class controllers constructor :
Yii configuration
Library loading
The classes in the installed Composer packages can be autoloaded using the Composer autoloader. Make sure the entry script of your application contains the following lines to install the Composer autoloader:
In the same file, register a new dependency :
Injection of the service
The JsUtils singleton can then be injected into controllers
Symfony configuration
Library loading
If you do not use the Composer autoloader file, you can also load phpMv-UI with Ps4ClassLoader :
Symfony 4
Create a service inheriting from JquerySemantic
Check that autowiring is activated in config/services.yml:
You can then use dependency injection on properties, constructors or setters:
Symfony 3
Injection of the service
Create 2 services in the app/config/services.yml file :
- The first for the JsUtils instance
- The second for the controller
It is then possible to inject the Symfony container and the JsUtils service in the controller constructor :
CakePhp configuration
Component creation
Copy the file JsUtilsComponent.php located in vendor/phpmv/php-mv-ui/Ajax/php/cakephp to the src/controller/component folder of your project
Component loading in controllers
Add the JsUtils component loading in the initialize method of the base controller AppController, located in src/controller/appController.php
Usage
the jquery object in controller will be accessible on
$this->JsUtils->jquery
Code completion in IDE
With most IDEs (such as Eclipse or phpStorm), to get code completion on the $jquery
instance, you must add the following property in the controller documentation: