I'm creating a package that uses internally this hashid package.
How can I register a third party facade inside a custom package?
I tried three options and none of them worked.
Version - Composer
"aliases": { "Hashids": "Vinkla\\Hashids\\Facades\\Hashids" }Version - inside my ServiceProvider with alias
class MyPackageServiceProvider extends ServiceProvider { public function register() { ... $this->app->alias(\Vinkla\Hashids\Facades\Hashids::class, 'Hashids'); }Version - inside my ServiceProvider with AliasLoader
class MyPackageServiceProvider extends ServiceProvider { public function register() { ... $loader = \Illuminate\Foundation\AliasLoader::getInstance(); $loader->alias('Hashids', \Vinkla\Hashids\Facades\Hashids::class); }
When I'm testing the code, I get the error:
Error: Call to undefined method Vinkla\Hashids\Facades\Hashids::encode()
inside
/** @test */
public something_to_test()
{
dd(\Hashids::encode(1));
}