Search

Laravel Artisan Tinker: The buffer Command

December 7, 2016 —John Koster

The buffer command is useful when entering multi-line expressions. It can be used at any time to view the contents of the buffer when entering multi-line expressions without interrupting the expression input. The following example sessions demonstrates the usage of the buffer command:

1>>> function longFunction() {
2... // Some comment
3... // More comments
4...
5... // multi-line
6... // expression
7... buffer
80: function longFunction() {
91: // Some comment
102: // More comments
113: // multi-line
124: // expression
13... return "hello";
14... }
15=> null
16>>> longFunction();
17=> "hello"
18>>>

The --clear option can be supplied to the buffer command to clear the contents of the current buffer.