Search

Laravel Artisan Tinker: The trace Command

December 7, 2016 —John Koster

The trace command can be used to show the current call stack. By default, it shows the last 10 lines of the call stack, but this can be configured using the -n option:

1>>> trace
2 0: Illuminate\Foundation\Console\TinkerCommand->fire() at n/a:n/a
3 1: call_user_func_array() at vendor\laravel\framework\src\Illuminate\
4 Container\Container.php:507
5 2: Illuminate\Container\Container->call() at vendor\laravel\framework\src\
6 Illuminate\Console\Command.php:169
7 3: Illuminate\Console\Command->execute() at vendor\symfony\console\Command\
8 Command.php:256
9 4: Symfony\Component\Console\Command\Command->run() at vendor\laravel\
10 framework\src\Illuminate\Console\Command.php:155
11 5: Illuminate\Console\Command->run() at vendor\symfony\console\
12 Application.php:815
13 6: Symfony\Component\Console\Application->doRunCommand() at vendor\symfony\
14 console\Application.php:186
15 7: Symfony\Component\Console\Application->doRun() at vendor\symfony\
16 console\Application.php:117
17 8: Symfony\Component\Console\Application->run() at vendor\laravel\
18 framework\src\Illuminate\Foundation\Console\Kernel.php:111
19 9: Illuminate\Foundation\Console\Kernel->handle() at artisan:36

To show the last 20 lines of the call stack, simply supply it using the -n20 option; to view a range of the call stack supply an option similar to -n5-20.