Skip to content

Commit 6574b71

Browse files
committed
v1.0.0
1 parent 8720c92 commit 6574b71

23 files changed

+1507
-157
lines changed

.vscode/.htaccess

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deny from all

.vscode/launch.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Listen for Xdebug",
9+
"type": "php",
10+
"request": "launch",
11+
"port": 9003
12+
}
13+
]
14+
}

README.md

+38-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
11
# php-xout
2-
A more readable implementation of PHP´s var_dump() function
2+
A more readable, syntax highlighted implementation of PHPs `var_dump()` or `print_r()` function.
3+
*Compatible with all PHP versions **back to 5.4***
4+
5+
## Installation
6+
### Via Composer
7+
`composer require alddesign/php-xout`
8+
### Manual
9+
Downlaod the package and load `xout.php`:
10+
```php
11+
require_once 'xout.php'
12+
```
313

414
## Usage
515
```php
6-
require('xout.php');
16+
//code before...
17+
$array =
18+
[
19+
'cars' => ['audi','bmw','volkswagen'],
20+
'settings' => (object)
21+
[
22+
'drive' => true,
23+
'disable_car' =>
24+
function(){}
25+
],
26+
'value' => 220.25,
27+
'active' => null
28+
];
729

8-
$var = ['cars' => ['audi','bmw'], 'nothing' => (object)['name' => 'Mario', 'age' => 34]];
30+
//Call xout
31+
Xout::xout($array);
32+
33+
//Or use the shorthand function:
934
xout($var);
1035
```
11-
This will output the contents of <code>$var</code> to the browser and call <code>die();</code> (Unless you specify <code>$dontDie = true</code>)
1236

13-
The output will look like:
37+
The output will look like this:
38+
![output](<test/output.png>)
39+
40+
## Remarks
41+
### Parameters
42+
- **value**: The expression to output
43+
- **return** (bool): If set to `true` the resulting html is being returned insted of echoing it. Default: `false`
44+
- **dontDie** (bool): If set to `true` the script will not terminated. When `return` is set to `true`, this parameter has no effect. Default: `false`
1445

15-
![output](<out.png>)
46+
### Customization
47+
In `xout.php` you can change many options like font, color, brace style,...

composer.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "alddesign/php-xout",
3+
"description": "A more readable implementation of PHPs var_dump() function",
4+
"version": "1.0.0",
5+
"support": {
6+
"issues": "https://github.com/ankane/alddesign/php-xout/issues",
7+
"source": "https://github.com/ankane/alddesign/php-xout"
8+
},
9+
"authors": [
10+
{
11+
"name": "alddesign"
12+
}
13+
],
14+
"autoload": {
15+
"files": ["xout.php"]
16+
},
17+
"require": {
18+
"php": ">= 5.4"
19+
}
20+
}

composer.lock

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out.png

-4.65 KB
Binary file not shown.

test.php

-40
This file was deleted.

test/output.png

8.27 KB
Loading

test/test.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
require '../xout.php';
3+
4+
class Train
5+
{
6+
public $description = 'Shinkansen';
7+
public function activate(){}
8+
}
9+
10+
$something =
11+
[
12+
'fruits' => ['apple', 'banana', 'strawberry'],
13+
'person' =>
14+
[
15+
'name' => 'Mario',
16+
'age' => 34,
17+
'rating' => 7.34,
18+
'registered' => false,
19+
'picture' => null
20+
],
21+
'car' => (object)
22+
[
23+
'brand' => 'BWM',
24+
'hp' => 220.25,
25+
'drive' => function(){}
26+
],
27+
'train object' => new Train(),
28+
'emtpy array' => [],
29+
'empty object' => (object)[],
30+
'nested array' => [[[[]]]],
31+
];
32+
33+
xout($something);

vendor/autoload.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
// autoload.php @generated by Composer
4+
5+
if (PHP_VERSION_ID < 50600) {
6+
if (!headers_sent()) {
7+
header('HTTP/1.1 500 Internal Server Error');
8+
}
9+
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10+
if (!ini_get('display_errors')) {
11+
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12+
fwrite(STDERR, $err);
13+
} elseif (!headers_sent()) {
14+
echo $err;
15+
}
16+
}
17+
trigger_error(
18+
$err,
19+
E_USER_ERROR
20+
);
21+
}
22+
23+
require_once __DIR__ . '/composer/autoload_real.php';
24+
25+
return ComposerAutoloaderInit0ea57707cf328774930a8944662deffc::getLoader();

0 commit comments

Comments
 (0)