@@ -27,7 +27,6 @@ require 'sage.phar';
27
27
sage('Hello, 🌎!');
28
28
```
29
29
30
-
31
30
## Usage
32
31
33
32
``` php
@@ -45,7 +44,7 @@ sage(1); // shortcut for dumping trace
45
44
| ` ssage ` | ` ss ` | Simple dump |
46
45
| ` ssaged ` | ` ssd ` | Simple dump & die |
47
46
| ` sagetrace ` | ` s(1) ` | Debug backtrace (same as ` \Sage::trace() ` ) |
48
- | --- | ` s(2) ` | Backtrace without the arguments - just the paths |
47
+ | --- | ` s(2) ` | Backtrace without the arguments - just the paths |
49
48
50
49
### Simple dump:
51
50
@@ -57,16 +56,17 @@ sage(1); // shortcut for dumping trace
57
56
58
57
### More cool stuff 🤯
59
58
60
- Sage determines the ** passed variable name** and as a side effect can detect all sort of prefixes to the call. Use it
59
+ Sage determines the ** passed variable name** and as a side effect can detect all sort of prefixes to the call. Use it
61
60
for some common on-the-fly adjustments to the dump output.
62
61
63
62
Examples:
64
63
65
64
``` php
66
65
~ss($var); // outputs plain text
67
66
$output = @ss($var); // returns output instead of displaying it
67
+ ! sage($var); // ignores depth limit for large objects
68
68
print sd($var); // saves output into "sage.html" in the current directory
69
- +sage ($var); // ignores depth limit for large objects
69
+ print ! sd ($var); // saves output into "sage.html" while also ignoring the output depth limit!
70
70
```
71
71
72
72
See [ Advanced section] ( #-advanced-tips--tricks ) below for more tricks.
@@ -132,9 +132,8 @@ Sage::$theme = Sage::THEME_LIGHT;
132
132
133
133
Add this entry to the ` autoload.files ` configuration key in ` composer.json ` :
134
134
135
- ``` json
135
+ ``` js
136
136
" autoload" : {
137
- /* ... */
138
137
" files" : [
139
138
" config/sage.php" /* <--------------- this line */
140
139
]
@@ -182,7 +181,7 @@ Make visible source file paths clickable to open your editor. Available options
182
181
* ` 'emacs' `
183
182
* ` 'macvim' `
184
183
* ` 'phpstorm' `
185
- * ` 'phpstorm-plugin ' ` - default,
184
+ * ` 'phpstorm-remote ' ` - default,
186
185
requires [ IDE Remote Control] ( https://plugins.jetbrains.com/plugin/19991-ide-remote-control ) plugin.
187
186
* ` 'idea' `
188
187
* ` 'vscode' `
@@ -296,6 +295,9 @@ Sage::dump($GLOBALS, $_SERVER);
296
295
297
296
// ss() will display a more basic, javascript-free display (but with colors)
298
297
ss($GLOBALS, $_SERVER);
298
+ // to recap: s() or sage() - dumps. Add "d" to die afterwards: sd(), saged()
299
+ // preppend "s" to simplify output: ss(), ssage().
300
+ // works in combination, too: ssd() and ssagedd() will dump in "simple mode" and die!
299
301
300
302
// prepending a tilde will make the output *even more basic* (rich->basic and basic->plain text)
301
303
~d($GLOBALS, $_SERVER); // more on modifiers below
@@ -316,7 +318,8 @@ Sage::enabled(false);
316
318
sd('Get off my lawn!'); // no effect
317
319
```
318
320
319
- * Sage supports keyboard shortcuts! Just press <kbd >d</kbd > when viewing output and the rest is self-explanatory (p.s.
321
+ * Sage supports keyboard shortcuts! Just press <kbd >d</kbd > when viewing output and the rest is self-explanatory, try it
322
+ out! (p.s.
320
323
vim-style ` hjkl ` works as well);
321
324
* Call ` Sage::enabled(Sage::MODE_PLAIN); ` to switch to a simpler, js-free output.
322
325
* Call ` Sage::enabled(Sage::MODE_TEXT_ONLY); ` for pure-plain text output which you can save or pass around by first
@@ -341,17 +344,17 @@ sd('Get off my lawn!'); // no effect
341
344
| Prefix | | Example |
342
345
| --------| ----------------------------------------------| --------------|
343
346
| print | Puts output into current DIR as sage.html | print sage() |
344
- | + | Dump ignoring depth limits for large objects | + sage() |
347
+ | ! | Dump ignoring depth limits for large objects | ! sage() |
345
348
| ~ | Simplifies sage output (rich->html->plain) | ~ sage() |
346
349
| - | Clean up any output before dumping | - sage() |
347
- | ! | Expand all nodes (in rich view) | ! sage() |
350
+ | + | Expand all nodes (in rich view) | + sage() |
348
351
| @ | Return output instead of displaying it | @ sage() |
349
352
350
353
* Sage also includes a naïve profiler you may find handy. It's for determining relatively which code blocks take longer
351
354
than others:
352
355
353
356
``` php
354
- Sage::dump( microtime() ); // just pass microtime()
357
+ Sage::dump( microtime() ); // just pass microtime() - also works if you pass NOTHING: s();
355
358
sleep( 1 );
356
359
Sage::dump( microtime(), 'after sleep(1)' );
357
360
sleep( 2 );
@@ -395,10 +398,10 @@ sd( microtime(), 'final call, after sleep(2)' );
395
398
### 💬 Why does Sage look so much like Kint? A.K.A. Why does this have so few stars?
396
399
397
400
Because it <b >is</b > Kint, and I am its author, however the project was [ ** forcibly taken over
398
- ** ] ( https://github.com/kint-php/kint/commit/1ea81f3add81b586756515673f8364f60feb86a3 ) from me by a malicious
401
+ ** ] ( https://github.com/kint-php/kint/commit/1ea81f3add81b586756515673f8364f60feb86a3 ) by a malicious
399
402
contributor!
400
403
401
- Instead of fighting DMCA windmills, I chose to fork and rename the last ** good** version and continue under a new name!
404
+ Instead of fighting DMCA windmills, I chose to fork and rename the last good version and continue under a new name!
402
405
403
406
You can use Sage as a drop-in replacement for Kint. Simple.
404
407
0 commit comments