PHP code example of taviroquai / mask

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

    

taviroquai / mask example snippets



class MyView
{
    protected $title = 'Hello';
    protected function logic()
    {
        return 'World!';
    }
}


use Taviroquai\Mask\Mask;

class MyView
{
    use Mask;
    
    protected $title = 'Hello';
    protected function logic()
    {
        return 'World!';
    }
}


$view = new MyView;
echo $view->mask('template');


// Set cache path
Mask::$templateCachePath = './path/to/cache';

// Set templates path
Mask::$templatePath = './path/to/templates';

// Choose what properties to publish by overriding getMaskData()
class MyView
{
    use Mask;
    
    protected $property1;
    protected $property2;
    
    public function getMaskData()
    {
        return array(
            'property2' => 'override'
        );
    }
}