-
-
Notifications
You must be signed in to change notification settings - Fork 30
Supports for class aliases #35
Comments
That would be very nice to have, but I couldn't find how it was done last time I checked |
In spatie package it had been done by .psysh.php. And another one solution is dispatch event before shell execution and register short class loader in the listener. I can make PR for it. |
Maybe that could do, but rather than doing this directly before the shell execution which implies having an overhead (which is already consequent) before running the command, it would be possible to do that in a Symfony Compiler pass. That way:
I'm a bit concerned however by the side-effects of registering all of those aliases like that, how are conflicts handled? |
There are no conflicts. bin/console psysh
$entity = new User; loader will receive So imagine that we have two classes bin/console psysh
$loader = new Loader; only the first class from composer class map ( Another loader instance you can create only with full namespace definition. $loader2 = new App\Services\Loader |
And I think it's not pretty good idea to register class loader in the compiler class. In such case it will have side effects for none shell development. We need it only in when we in REPL. Maybe it would be better register class loader in |
Can you provide class aliases out of the box? I talk about something like https://github.com/spatie/laravel-tinker-tools
It would be very useful when we can do:
The text was updated successfully, but these errors were encountered: