1

I had a Laravel project and I've added the following line in config/app.php file (aliases section).

'Telegram'  => Telegram\Bot\Laravel\Facades\Telegram::class

And then it was working:

use Telegram\Bot\Laravel\Facades\Telegram;

Now I've migrated to Lumen micro framework. How can I do the same thing in Lumen?

Noted that I've added the following line in boostrap/app.php file (and $app->withFecade is uncommented now)

class_alias('Telegram\Bot\Laravel\Facades\Telegram::class', 'Telegram');

But still it is unknown and php artisan vendor publish command throws:

Class 'Telegram\Bot\Laravel\Facades\Telegram::class' not found 

Any idea?

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
Martin AJ
  • 6,261
  • 8
  • 53
  • 111
  • 2
    Take a look at this answer: https://stackoverflow.com/a/45186418/1046387 alternatively you may need to re-run `composer dumpautoload` – Harry Oct 01 '18 at 12:59
  • If you do `use Telegram\Bot\Laravel\Facades\Telegram` you don't really need to set an alias in either framework – apokryfos Oct 01 '18 at 13:02

1 Answers1

2

You should use either:

class_alias(Telegram\Bot\Laravel\Facades\Telegram::class, 'Telegram');

(here it can be imported)

or

class_alias('Telegram\Bot\Laravel\Facades\Telegram', 'Telegram');
Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291