1. Go to this page and download the library: Download owlycode/interlacing 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/ */
owlycode / interlacing example snippets
use OwlyCode\Interlacing\Interlacing;
// index.php
$i = Interlacing::fromFile(__DIR__.'/grammar.yaml');
echo $i->resolve('root'); // Will output things like "the hoary ocelot".
namespace Custom\Plugin;
class Prepend implements AlterationInterface
{
// An alteration always receive the placeholder name, the actual resolved value and the args provided to the alteration
public function prepend(string $placeholder, string $input, array $args): string
{
return $args[0] . $input;
}
// Returns the list of alterations by name.
public function getAlterations(): array
{
return [
'prepend' => [$this, 'prepend'], // Usage: {{ placeholder|prepend("prefix") }}
];
}
}
namespace Custom\Plugin;
class Now implements ResolverInterface
{
public function resolve($name): ?string
{
if ($name === 'now') {
return (new \Datetime())->format('Y-m-d H:i:s');
}
return null;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.