1. Go to this page and download the library: Download ctxkiwi/vue-pre 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/ */
ctxkiwi / vue-pre example snippets
$vue = new \VuePre\Engine();
$vue->setCacheDirectory(__DIR__ . '/cache');
// Method 1
$data = ["name" => "world"];
$html = $vue->renderHtml('<div>Hello {{ name }}!</div>', $data);
// Method 2 - Using component directory (
// If you set your directory like this
$vue->setComponentDirectory(__DIR__ . '/components');
// It's going to look for any .php file and register the filename as a component
// So, if you have components/pages/homepage.php
// It will use this file for the <homepage> component
// Based on your last render
$vue->getScripts();
$vue->getTemplateScripts(); // only template scripts
$vue->getJsScripts(); // only js scripts
// By component name
$vue->getTemplateScript('my-page');
$vue->getJsScript('my-page');
// Usefull
$vue->getRenderedComponentNames();