1. Go to this page and download the library: Download novatorius/blueprint 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/ */
novatorius / blueprint example snippets
use Novatorius\Blueprint\BlueprintProcessor;
use Novatorius\Blueprint\PlaceholderDefinition;
$definition = new PlaceholderDefinition('{', '}', [
'name' => 'Alice',
'day' => 'Monday'
]);
$alternativeDefinition = new PlaceholderDefinition('|*', '*|', [
'name' => 'Alice',
'day' => 'Monday'
]);
// Define your initial template (the "blueprint").
$template = "Hello, {name}! Today is |*day*|.";
// Process the template using the defined placeholders.
$processed = (new BlueprintProcessor($template))
->processDefinition($definition)
->processDefinition($alternativeDefinition)
->toString();
echo $processed; // Outputs: "Hello, Alice! Today is Monday."
$template = "Hello, {name}! Today is %%day%%.";
$definition1 = new PlaceholderDefinition('{', '}', ['name' => 'Alice']);
$definition2 = new PlaceholderDefinition('%%', '%%', ['day' => 'Monday']);
$processed = (new BlueprintProcessor($template))
->processDefinition($definition1)
->processDefinition($definition2)
->toString();
echo $processed; // Outputs: "Hello, Alice! Today is Monday."
$template = "Hello, {name}! Today is %%day%%.";
$definition1 = new PlaceholderDefinition('{', '}', ['name' => 'Alice']);
$definition2 = new PlaceholderDefinition('%%', '%%', ['day' => 'Monday']);
$processed = (new BlueprintProcessor($template))
->processDefinition($definition1)
->processDefinition($definition2);
echo $processed; // Outputs: "Hello, Alice! Today is Monday."
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.