-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout.page
42 lines (36 loc) · 1.58 KB
/
about.page
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
title: Kint
description: Smart and feature rich PHP data inspector.
icon: 'M19,19V5H5V19H19M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5C3,3.89 3.9,3 5,3H19M11,7H13V11H17V13H13V17H11V13H7V11H11V7Z'
color: '#54a932'
author: Taufik Nurrohman
image: /lot/x/kint/index.png
link: 'http://kint-php.github.io/kint'
type: Markdown
version: 1.0.0
...
Mecha already has a built-in function called `test()` to perform simple data inspections returned by PHP expressions.
This extension provides a more useful and complete inspection function by using the global `kint()` function.
### Usage
The way you use it is exactly the same as you would use the `test()` function, so it will be easier for you to refactor
your existing code if you want to use this extension in the long run. It is a good practice to always call this function
within a non-production mode conditional statement, so that this function will not be executed when you are already in
production mode:
~~~ .php
if (defined('TEST') && TEST) {
if (function_exists('kint')) {
kint($_COOKIE, $_ENV, $_FILES, $_GET, $_POST, $_REQUEST, $_SERVER);
} else {
test($_COOKIE, $_ENV, $_FILES, $_GET, $_POST, $_REQUEST, $_SERVER);
}
exit;
}
~~~
I really recommend you to install this extension if you want to develop [Panel](https://github.com/mecha-cms/x.panel)
features on your own. By using this extension, the Panel data inspection results will look very neat and tidy:
~~~ .php
Hook::set('_', function ($_) {
kint($_, $_GET, $_POST, $_SESSION, $_SERVER);
exit;
}, 1000); // Execute as late as possible…
~~~