在Laravel中使用Composer中的供应商类 [英] Use a vendor class from composer in Laravel

查看:63
本文介绍了在Laravel中使用Composer中的供应商类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Laravel中如何使用此类/库: https://github.com/planetteamspeak/ts3phpframework

How would I go around using this class/library in Laravel: https://github.com/planetteamspeak/ts3phpframework

我试图将其包含在config/app.php提供程序中,如下所示:

I tried to include it in config/app.php providers like this:

planetteamspeak\ts3-php-framework\libraries\TeamSpeak3.php::class,

但是我一直收到此错误,但找不到任何对我有帮助的东西.我还尝试在末尾不添加.php的情况下添加它,但这也无济于事.

But I keep getting this error, and I couldn't find anything about it that helped me. I also tried to add it without .php at the end but that doesn't help either.

Fatal error: Uncaught ReflectionException: Class log does not exist in PATH-HERE\vendor\laravel\framework\src\Illuminate\Container\Container.php:734

感谢您的帮助!

推荐答案

要在Laravel中使用您的类/库,首先您应该将composer.json依赖项放入ts3phpframework

To use your class/library in Laravel, first you should put in your composer.json dependecy for that ts3phpframework

"require": {
"planetteamspeak/ts3phpframework" : "1.*"
}

在内部文件app.php中,您需要做2件事(类似这样,不知道别名和提供者的正确名称(一定要先进行作曲家更新)

Inside file app.php you need to do 2 things (something like this, dunno the proper name of alias and provider (be sure to do composer update before doing it)

首先添加提供程序(只是提示操作方法)

First add provider (just a hint how to do it)

'providers' => [
ts3phpframework/ts3phpframeworkProvider::class
]

第二个添加别名(只是一个提示)

Second add alias (just a hint how to do it)

'aliases' => [
'ts3phpframework' => ts3phpframework\Facades\ts3phpframework::class,
]

如果您无法使用composer获取此库,请使用.

If you won't be able to get this library with composer, then add it manually with a help of this. If you won't be able to find alias and provider, then create them manually with a help of this.

最后,此处

这篇关于在Laravel中使用Composer中的供应商类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆