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

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

问题描述

我想安装 guzzle

从那个教程,要求需要作曲家自动加载器.所以似乎需要添加 require 'vendor/autoload.php';我在哪里添加脚本?

我使用的是 laravel 5.6

解决方案

如果你打算在 Laravel 中安装 guzzle,你不需要做任何事情.上面的例子实际上是针对核心php的.Laravel 会自动为你做.

只需在终端中运行 composer require guzzlehttp/guzzle.(当然在你的 Laravel 项目实际所在的目录中.)
并在您将从中调用 guzzle 的文件顶部添加 use GuzzleHttpClient;.

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

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

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

I using laravel 5.6

解决方案

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.

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

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

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