简体   繁体   English

如何在流明中定义外墙?

[英]How can I define a facade in Lumen?

I had a Laravel project and I've added the following line in config/app.php file ( aliases section). 我有一个Laravel项目,并且在config/app.php文件( aliases部分)中添加了以下行。

'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. 现在,我已经迁移到Lumen微框架。 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) 注意,我已经在boostrap/app.php文件中添加了以下行(并且现在不注释$app->withFecade

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

But still it is unknown and php artisan vendor publish command throws: 但是仍然是未知的, php artisan vendor publish命令抛出:

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

Any idea? 任何想法?

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');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM