rohiri/laraguzz

Guzzle 作为 Laravel 的服务提供商

v1.2 2021-02-06 00:27 UTC

This package is auto-updated.

Last update: 2024-09-06 08:19:29 UTC


README

Licencia Downloads Version PHP

使用 Composer 安装

Guzzle ~1.0

composer require rohiri/laraguzz

注册服务提供者。

/configs/app.php

    ...
    'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        ...

        /*
         * Application Service Providers...
         */
        ...
        'Rohiri\Guzzle\Providers\Guzzle'
    ],

启用门面

/configs/app.php

    ...
    'aliases' => [
        ...
        'Guzzle' => 'Rohiri\Guzzle\Facades\Guzzle'
    ],

如何使用?

发送请求

  $respuesta = \Guzzle::get('https://youtube.com');

POST

$response = Guzzle::post(
    'https://my.app/test',
    [
        'form_params' => [
            'user' => pepito,
            'pass' => 1
        ]
    ]
);