Closed
Description
I'd like to use https://github.com/symfony/console/blob/master/Helper/Table.php in a similar manor to dump()
. I know that the console command has a nice table helper as shown in here like this:
.
I'd like to use this hypothetical "table_dump" feature in the php artisan tinker
and phpunit
contexts.
$ php artisan tinker
Psy Shell v0.9.9 (PHP 7.2.24-0ubuntu0.18.04.1 — cli) by Justin Hileman
>>> new Symfony\Component\Console\Helper\Table()
TypeError: Too few arguments to function Symfony/Component/Console/Helper/Table::__construct(), 0 passed in Psy Shell code on line 1 and exactly 1 expected
>>> app(\Symfony\Component\Console\Output\OutputInterface::class)
Illuminate/Contracts/Container/BindingResolutionException with message 'Target [Symfony/Component/Console/Output/OutputInterface] is not instantiable.'
>>> app()->make(\Symfony\Component\Console\Output\OutputInterface::class)
Illuminate/Contracts/Container/BindingResolutionException with message 'Target [Symfony/Component/Console/Output/OutputInterface] is not instantiable.'
>>> app()->make(\Symfony\Component\Console\Helper\Table::class)
Illuminate/Contracts/Container/BindingResolutionException with message 'Target [Symfony/Component/Console/Output/OutputInterface] is not instantiable while building [Symfony/Component/Console/Helper/Table].'
>>>
How would you do this? I tried reading laravel's code but it's just infinite layers of automagic.
It would be cool if this existing functionality was exposed as dump_table($data)