Download the PHP package josantonius/cli-printer without Composer
On this page you can find all versions of the php package josantonius/cli-printer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cli-printer
PHP CliPrinter library
PHP library for print messages in the command line interface (CLI). Optionally supports Monolog\Logger.
For development or test environments you can disable on-console message
output by defining a constant named DISABLE_CONSOLE_PRINTING
.
- Requirements
- Installation
- Available Classes
- CliPrinter Class
- Color Class
- Usage
- Tests
- TODO
- Changelog
- Contribution
- Sponsor
- License
Requirements
-
Operating System: Linux.
- PHP versions: 8.1 | 8.2.
Installation
The preferred way to install this extension is through Composer.
To install PHP CliPrinter library, simply:
The previous command will only install the necessary files, if you prefer to download the entire source code you can use:
You can also clone the complete repository with Git:
Available Classes
CliPrinter Class
Josantonius\CliPrinter\CliPrinter
Create new instance:
Display a message on the console:
Dynamically display a message using the message tag as the method name:
Add an instance of Monolog\Logger to add a log for each message displayed:
Print new lines on the console:
Set the number of line breaks before and after a message:
Set the default color of the message tags:
Set the color for a message tag:
Color Class
Josantonius\CliPrinter\Color
Available colors:
Usage
Example of use for this library:
Displaying messages
Displaying messages without a tag
Displaying preset messages via their key
Displaying formatted messages
Changing the line breaks before and after each message
Adding extra line breaks
Changing default color of tags
Set a custom color for each tag
Displaying messages using dynamic methods
Using Monolog\Logger
Tests
To run composer and to execute the following:
Run unit tests with PHPUnit:
Run code standard tests with PHPCS:
Run PHP Mess Detector tests to detect inconsistencies in code style:
Run all previous tests:
TODO
- [ ] Add new feature
- [ ] Improve tests
- [ ] Improve documentation
- [ ] Improve English translation in the README file
- [ ] Refactor code for disabled code style rules (see phpmd.xml and phpcs.xml)
Changelog
Detailed changes for each release are documented in the release notes.
Contribution
Please make sure to read the Contributing Guide, before making a pull request, start a discussion or report a issue.
Thanks to all contributors! :heart:
Sponsor
If this project helps you to reduce your development time, you can sponsor me to support my open source work :blush:
License
This repository is licensed under the MIT License.
Copyright © 2023-present, Josantonius