在Laravel中使用PHP库 [英] Using php library in Laravel

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

问题描述

我使用composer安装了以下库: https://github.com/kreait/firebase-php

I installed using composer the following library: https://github.com/kreait/firebase-php

不幸的是,没有关于如何在Laravel项目中添加和使用它的文档.

Unfortunetly, there are no documentations about how to add it to include and use it on my Laravel project.

我如何use这堂课?目前,我得到这个:

How I can use this class? Currently I get this:

消息":未找到类'App \ Http \ Controllers \ Firebase'

message":"Class 'App\Http\Controllers\Firebase' not found"

推荐答案

您当前位于名称空间中,这意味着如果未指定任何内容,它将进入:

You're currently in a namespace, which mean if nothing is specified it'll look in:

<?php

namespace App\Http\Controllers;

指定要在名称空间中导入您的库:

Specify to import your library in the namespace:

use Firebase;

它将在控制器中加载该类.

It will load the class in the controller.

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

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