laravel / tinker

Powerful REPL for the Laravel framework.
https://laravel.com/docs/artisan#tinker
MIT License
7.32k stars 130 forks source link

[2.x] Support vendor class aliasing #88

Closed jasonvarga closed 4 years ago

jasonvarga commented 4 years ago

This PR adds support for aliasing classes and namespaces inside the vendor directory.

Now if you're using a package within Tinker frequently you can add this sort of thing:

'alias' => [
  'Statamic\Facades',
],

I wanted to add tests, but there weren't any so this also contains tests for existing functionality. Not sure if the dummy config helper is the way to go, but it worked.

Closes #76

jasonvarga commented 4 years ago

@GrahamCampbell Now you've changed the signature of __construct and register. Isn't it technically a breaking change now?

GrahamCampbell commented 4 years ago

No. They have default values, and the old code was totally broken out side of laravel anyway. This package was made specifically so tinker could be used outside of laravel/framework, so we need to support that.

jasonvarga commented 4 years ago

Alrighty.

jasonvarga commented 4 years ago

Ah yeah the fallbacks. Cool.

You could have just asked for that. But hey, less for me to do. 🤘

GrahamCampbell commented 4 years ago

Was quicker for me to just write the code than do a bad job of explaining how to do it. The clearest way for me to explain what I wanted was to write it. ;)

jasonvarga commented 4 years ago

Thanks!

driesvints commented 4 years ago

Thanks to you both 👍