且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何在 Laravel 中要求作曲家自动加载器?

更新时间:2023-11-17 10:51:34

如果你打算在 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.