1. Go to this page and download the library: Download mindplay/implant 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/ */
mindplay / implant example snippets
class AssetModel
{
public $js = [];
public $css = [];
}
class JQueryPackage implements AssetPackage
{
/**
* @param AssetModel $model
*/
public function defineAssets($model)
{
$model->js[] = 'https://code.jquery.com/jquery-1.11.3.min.js';
}
public function listDependencies()
{
return []; // JQuery has no dependencies
}
}
class BootstrapPackage implements AssetPackage
{
/**
* @param AssetModel $model
*/
public function defineAssets($model)
{
$root = '/assets/bootstrap';
$model->js[] = "{$root}/js/bootstrap.min.js";
$model->css[] = "{$root}/css/bootstrap.min.css";
$model->css[] = "{$root}/css/bootstrap-theme.min.css";
}
public function listDependencies()
{
return [JQueryPackage::class];
}
}
$manager = new AssetManager();
$manager->add(BootstrapPackage::class);
$model = new AssetModel();
$manager->populate($model);
/**
* @var AssetModel $model
*/
$manager->inject(
function ($model) {
$model->js[] = "/assets/js/page_init.js"
},
[JQueryPackage::class]
);