-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,507 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Deny from all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Listen for Xdebug", | ||
"type": "php", | ||
"request": "launch", | ||
"port": 9003 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,47 @@ | ||
# php-xout | ||
A more readable implementation of PHP´s var_dump() function | ||
A more readable, syntax highlighted implementation of PHPs `var_dump()` or `print_r()` function. | ||
*Compatible with all PHP versions **back to 5.4*** | ||
|
||
## Installation | ||
### Via Composer | ||
`composer require alddesign/php-xout` | ||
### Manual | ||
Downlaod the package and load `xout.php`: | ||
```php | ||
require_once 'xout.php' | ||
``` | ||
|
||
## Usage | ||
```php | ||
require('xout.php'); | ||
//code before... | ||
$array = | ||
[ | ||
'cars' => ['audi','bmw','volkswagen'], | ||
'settings' => (object) | ||
[ | ||
'drive' => true, | ||
'disable_car' => | ||
function(){} | ||
], | ||
'value' => 220.25, | ||
'active' => null | ||
]; | ||
|
||
$var = ['cars' => ['audi','bmw'], 'nothing' => (object)['name' => 'Mario', 'age' => 34]]; | ||
//Call xout | ||
Xout::xout($array); | ||
|
||
//Or use the shorthand function: | ||
xout($var); | ||
``` | ||
This will output the contents of <code>$var</code> to the browser and call <code>die();</code> (Unless you specify <code>$dontDie = true</code>) | ||
|
||
The output will look like: | ||
The output will look like this: | ||
![output](<test/output.png>) | ||
|
||
## Remarks | ||
### Parameters | ||
- **value**: The expression to output | ||
- **return** (bool): If set to `true` the resulting html is being returned insted of echoing it. Default: `false` | ||
- **dontDie** (bool): If set to `true` the script will not terminated. When `return` is set to `true`, this parameter has no effect. Default: `false` | ||
|
||
![output](<out.png>) | ||
### Customization | ||
In `xout.php` you can change many options like font, color, brace style,... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "alddesign/php-xout", | ||
"description": "A more readable implementation of PHPs var_dump() function", | ||
"version": "1.0.0", | ||
"support": { | ||
"issues": "https://github.com/ankane/alddesign/php-xout/issues", | ||
"source": "https://github.com/ankane/alddesign/php-xout" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "alddesign" | ||
} | ||
], | ||
"autoload": { | ||
"files": ["xout.php"] | ||
}, | ||
"require": { | ||
"php": ">= 5.4" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
require '../xout.php'; | ||
|
||
class Train | ||
{ | ||
public $description = 'Shinkansen'; | ||
public function activate(){} | ||
} | ||
|
||
$something = | ||
[ | ||
'fruits' => ['apple', 'banana', 'strawberry'], | ||
'person' => | ||
[ | ||
'name' => 'Mario', | ||
'age' => 34, | ||
'rating' => 7.34, | ||
'registered' => false, | ||
'picture' => null | ||
], | ||
'car' => (object) | ||
[ | ||
'brand' => 'BWM', | ||
'hp' => 220.25, | ||
'drive' => function(){} | ||
], | ||
'train object' => new Train(), | ||
'emtpy array' => [], | ||
'empty object' => (object)[], | ||
'nested array' => [[[[]]]], | ||
]; | ||
|
||
xout($something); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
// autoload.php @generated by Composer | ||
|
||
if (PHP_VERSION_ID < 50600) { | ||
if (!headers_sent()) { | ||
header('HTTP/1.1 500 Internal Server Error'); | ||
} | ||
$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; | ||
if (!ini_get('display_errors')) { | ||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { | ||
fwrite(STDERR, $err); | ||
} elseif (!headers_sent()) { | ||
echo $err; | ||
} | ||
} | ||
trigger_error( | ||
$err, | ||
E_USER_ERROR | ||
); | ||
} | ||
|
||
require_once __DIR__ . '/composer/autoload_real.php'; | ||
|
||
return ComposerAutoloaderInit0ea57707cf328774930a8944662deffc::getLoader(); |
Oops, something went wrong.