Download the PHP package clytras/lyx without Composer
On this page you can find all versions of the php package clytras/lyx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package lyx
Short Description Lyx is a library of handfull PHP classes and functions
License BSD-3-Clause
Informations about the package lyx
Lyx
Lyx is a library of handfull PHP classes and functions. This is by no means a "perfect" PHP implementation; it's a collection of classes and functions that I've wrote over many years and its' origin is back at PHP 5.2, so there are still parts of code that need to be rewritten, modified or totally deleted. The main reason for publishing it, is because I need a quick way to install it using composer.
Requirements
PHP needs to be a minimum version of PHP 7.1.0. It's began with PHP 5.2 when I started building it, but there is no point supporting older versions < 7.1 of PHP. Some parts of the code may be in older PHP code style/methods, but I'll fix all those library parts maybe with the help of some other people that may be intersting or find itr useful.
Installation
Using composer
Downloading (not using autoloader)
Include the src/autoload.php
just once.
Tests
Test cases are not implemented yet, but there will be detailed and full feature tests using PHPUnit testing library.
Examples
Examples are located inside the \examples
directory. There are currently not many example cases covered, but there will be more added in the future.
Lyx\Strings\Str::format($text, $params = [], $options = false)
Str::format
params, support single array, associative nested arrays and even constants. Single array params are supported by numbers representing element index ex.{0}
,{1}
etc. Associative array params can be nested named like{param.arg1}
. It supports numbers zero padding like{0,5}
will produce00123
when a number123
will be passed. Floating point precision is supported like{0,.4}
will produce123.4500
when a number123.45
will be passed. Padding and floating point precision can be combined like{0,5.4}
will produce00123.4500
when123.45
passed. There is no floating point precision round methods implent yet but there will be added in the future. If we want to separate thousands using thousands separator, we add a slash after the zero padding number like{0,/.2}
will produce10,000.00
with the number10000
. It also converts numbers to hexadecimal, octal and binary formats usingX
(orx
for lowercase) for hex,O
for octal andB
for binary like{0:X}
will produceFE0
when0xfe0
or4064
will be passed;111111100000
with{0:B}
. Number converters also support zero padding{0:x,6}
will produce000fe0
when4064
passed.
OUTPUT
Lyx\System\Terminal
Terminal
class can be used to output colored format text to terminals. It uses a very simple format for setting foreground, background colors and attributes. The format for coloring is<f:[color-name]>
for foreground color,<b:[color-name]>
for background color and<a:[attr-name]>
for setting attributes. The colors are hierarchical, which means they open and close in hierarchiwal manner; the attributes just set and unset using the minus sign-
infront the attribute name we want to unset. For example<f:yellow,b:blue,a:underline>
will set the foreground color to yellow and background color to blue; we can open an other tag to add a color to the stack,<b:cyan>
will set the background color to cyan and when we call<b>
it will go back to blue where it was set before the cyan color; we can just close one tag to reset or go back;<f>
will go back one foreground color,<b>
will go back one background color,<a:-underline>
will clear the underline attribute,<a>
will reset all attributes, and<>
will reset everything to defaults.
OUTPUT
OUTPUT
API List
For now there is just an API list with all functions and classes. Maybe there will be a more detailed and documented navigation wised page in the future.
License
BSD-3-Clause
Copyright 2019 Lytras Christos
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.