1. Go to this page and download the library: Download clytras/lyx 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/ */
clytras / lyx example snippets
// Simple Str::format example
Lyx\Strings\Str::format("This is a simple {0} for {1} ('{0}', '{1}')", [
'format',
'testing'
]));
// This is a simple format for testing ('format', 'testing')
// Using assosiative arrays and constants
use Lyx\Strings\Str;
define("C_TEST", 'Const test!');
lyx_print(Str::format(
"This is an assoc keys {example} for {purpose} [{C_TEST}] ('{example}', '{purpose}')",
[
'example' => 'Case',
'purpose' => 'Testing'
]
));
// This is an assoc keys Case for Testing [Const test!] ('Case', 'Testing')
// Using assosiative nested arrays
use Lyx\Strings\Str;
lyx_print(Str::format(
"This is an assoc keys {example.arg1} for {purpose.a1} ('{example.arg2}', '{purpose.a2}')",
[
'example' => [
'arg1' => 'Example - Arg 1',
'arg2' => 'Ex - Arg 2'
],
'purpose' => [
'a1' => 'Testing 1',
'a2' => 'Test 2'
]
]
));
// This is an assoc keys Example - Arg 1 for Testing 1 ('Ex - Arg 2', 'Test 2')
// Using simple color formating or print removing the formating tags
use Lyx\System\Terminal;
$str = 'Test: <f:red,b:blue>This<f> <b:red>and<b> <f:green,a:underline>more<> <f:light-green>colors<f> <a:reverse:underline>test<a>';
// Print the text with terminal color formating
Terminal::println($str);
// Print the raw text without color formating tags
Terminal::printlnRaw($str);
// Using templates to set color formating with regular expressions
use Lyx\System\Terminal;
$html = <<<HTML
<html lang="en">
<head>
<title>
A Simple HTML Document
</title>
</head>
<body bgcolor="#E6E6FA">
<p align="center">This is a very simple HTML document</p>
<p>It only has two paragraphs</p>
</body>
</html>
HTML;
Terminal::printTmpl($html, [
// Use green to color all the tags
'/<(.|\\n)*
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.