Download the PHP package lsmj/phrint without Composer
On this page you can find all versions of the php package lsmj/phrint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phrint
phrint (/prɪnt/)
Simple and visual state testing for PHP programming. Works well when checking if data is returned by a method and/or quickly figuring out the data type. The p method is particularily useful for temporarily displaying data on an html page. This is especially effective in combination with hot reloading, so you can work on your method while seeing the returned result update everytime you save. The c (console) method is useful for printing out data in a console during testing.
Table of Contents
- Installation
- Install with Composer
- Usage
- Auto-load and import class
- Methods
- p (print)
- c (console)
- m (message)
- l (list)
Installation
Install with Composer
Uninstall:
Usage
Auto-load and import class
Require Composer's autoload.php if you're not using a framework that already takes care of this, like Laravel. Import the class with use lsmj\phrint
.
index.php:
or in public/index.php:
Methods
p (print)
Prints the input type and data on a clutter free bleached yellow background. Especially useful when tracking state types or data. Objects are JSON encoded.
p(mixed $input)
Code example:
Result:
c (console)
Prints the input type and content without formatting. Useful when printing messages in a console.
c(mixed $input)
m (message)
Prints the input data on a clutter free bleached yellow background. Useful when printing messages that needs to be easy to find visually.
m(string|int $input)
l (list)
Explodes and prints a comma-seperated string as a vertical list on a bleached yellow background. This is useful for viewing or counting elements (like in a CSV heading), creating a new array from the list, manipulating the element names or copying and pasting the resulting list into a spreadsheet.
l(string $input, [string $delimiter = "'"], [string $remove_string = null])
Code example:
Result:
The default delimiter is ,
but a different one can be passed as the second argument. The third argument is an optional regex
function that replaces the given input string with an empty string.
Code example:
Result: