PHP code example of php-http / laravel-httplug

1. Go to this page and download the library: Download php-http/laravel-httplug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

php-http / laravel-httplug example snippets



// config.app

'providers' => [
    ...,
    ...,

     Http\Httplug\HttplugServiceProvider::class,

],

'aliases' => [
    ...,
    ...,

    'Httplug'   => Http\Httplug\Facade\Httplug::class,

],





// Create a request using a MessageFactory
$factory = app()->make('httplug.message_factory.default');
$request = $factory->createRequest('GET', 'http://httpbin.org');

$httplug = app()->make('httplug');

// Send request with default driver
$response = $httplug->sendRequest($request);

// Send request with another driver
$response = $httplug->driver('curl')->sendRequest($request);

// Send request with default driver using facade
$response = Httplug::sendRequest($request);

// Send request with another driver using facade
$response = Httplug::driver('curl')->sendRequest($request)


php artisan vendor:publish --provider="Http\Httplug\HttplugServiceProvider"