PHP code example of leongrdic / dataplater

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

    

leongrdic / dataplater example snippets


$dp = new \Le\Dataplater\Dataplater(
    filename: 'template.html', // path relative to baseDir or an absolute path
    // OR
    template: '<html>...</html>', // doesn't have to be a full HTML document
    
    // optional:
    vars: [ 'var' => 'value', ], // global vars
    baseDir: 'app/templates/', // base directory for templates
    attr: 'data-custom' // custom base attribute
);

$html = $dp->render([
    'var' => 'local value',
    'function' => fn () => 'some value',
]);

php.count(users) > 0

php.array_reverse(links)

php.implode('-', php.explode(' ', someText))