我如何在Laravel中要求作曲家自动加载器? [英] How can I require composer autoloader in the laravel?

查看:68
本文介绍了我如何在Laravel中要求作曲家自动加载器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装guzzle https://github.com/guzzle/guzzle

I want to install guzzle https://github.com/guzzle/guzzle

我阅读了参考资料,但对本节感到困惑:

I read the reference, but I'm confused this section :

在该教程中,要求使用composer自动加载器.所以似乎需要添加require 'vendor/autoload.php'; 我在哪里添加脚本?

From that tutorial, asking for require composer autoloader. So seems needed to add require 'vendor/autoload.php'; Where I add the script?

我使用laravel 5.6

I using laravel 5.6

推荐答案

如果要在Laravel中安装枪口,则无需执行任何操作. 上面的示例实际上是针对核心php的. Laravel会自动为您完成此操作.

You don't have to do anything if you are going to install guzzle in Laravel. The example above is for core php actually. Laravel will automatically do it for you.

只需在终端中运行composer require guzzlehttp/guzzle. (当然,在您的laravel项目实际所在的目录中.)
并在要从中调用guzzle的文件的顶部添加use GuzzleHttp\Client;.

Just run composer require guzzlehttp/guzzle in your terminal. (of course in the directory where your laravel project actually is.)
And add use GuzzleHttp\Client; at the top of the file you will be calling guzzle from.

这篇关于我如何在Laravel中要求作曲家自动加载器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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