PHP code example of sinevia / php-library-template

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

    

sinevia / php-library-template example snippets


\Sinevia\Template::fromFile($templateFilepath, $data = array());

\Sinevia\Template::fromString($templateString, $data = array());

\Sinevia\Template::setCacheDirectory($cacheDirPath);
\Sinevia\Template::setCache($key, $content, $options = array());
\Sinevia\Template::getCache($key, $options = array());

\Sinevia\Template::minifyHtml($html);
\Sinevia\Template::minifyCss($css);
\Sinevia\Template::minifyJs($js);

$html = \Sinevia\Template::fromString($templateContent, [
     'page_meta_description' => $pageMetaDescription,
     'page_meta_keywords' => $pageMetaKeywords,
     'page_meta_robots' => $pageMetaRobots,
     'page_canonical_url' => $pageCanonicalUrl,
     'page_title' => $pageTitle,
     'page_content' => $pageContent,
]);

\Sinevia\Template::setCache('key','content',array(
     'post'=>true,
     'get'=>true,
     'session'=>true,
     'expires'=>3600 // Default
));

[layout::public/guest/layout.phtml]

CONTENT

 echo $content; 
json
    ""sinevia/php-library-template": "1.*"
    },