1. Go to this page and download the library: Download leongrdic/smplang 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 / smplang example snippets
$smpl = new \Le\SMPLang\SMPLang([
'variableName' => 'value',
]);
$smpl = new \Le\SMPLang\SMPLang([
'prepend' => fn(string $a): string => "hello $a",
'reverse' => strrev(...),
]);
$result = $smpl->evaluate('prepend("simple " ~ reverse("world"))');
// $result will be "hello simple dlrow"
$smpl = new \Le\SMPLang\SMPLang([
'foo' => 'bar',
]);
$result = $smpl->evaluate('foo !== "bar" ? "yes" : "no"');
// $result will be "no"
// SMPL can even be used as an (incredibly slow) JSON parser!
$smpl = new \Le\SMPLang\SMPLang();
$json = '{ "foo": null, "bar": 15.23, "baz": true, "arr": [5, 6], "str": "cool" }';
$result = $smpl->evaluate($json);
print_r($result);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.