PHP code example of leonickl / plate

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

    

leonickl / plate example snippets




eoNickl\Plate\Plate;

// Compile a .plate file to PHP code
$phpCode = Plate::file('view.plate');

// Cast to string to get the compiled PHP
echo (string) $phpCode;

function plug_plate(string $file, mixed ...$params): string
{
    return view($file, $params); // or however you import your views
}
plate
{{ :$var = "test" }}       // Execute PHP without printing
plate
{{ each: $items as $item }}
    <p>{{ $item }}</p>
{{ each; }}
bash
php index.php | php