2017 © Pedro Peláez
 

library llrequest

Pacote para conexão de rests Http e SOAP

image

lliure/llrequest

Pacote para conexão de rests Http e SOAP

  • Monday, February 20, 2017
  • by jomadee
  • Repository
  • 3 Watchers
  • 2 Stars
  • 136 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 13 % Grown

The README.md

Package Documentation: llRequest

Overview

llRequest is a versatile PHP library for making SOAP and HTTP API requests. It simplifies the process of interacting with remote services by providing an easy-to-use interface for sending requests and handling responses., (*1)

Installation

To use llRequest, you can include it in your project via Composer. Add the following line to your composer.json file:, (*2)

"require": {
    "ll/request": "^1.0"
}

Then run composer install to install the package., (*3)

Examples

SOAP Request

use ll\Request\Request;

// Set SOAP headers
$headers = [
    'login' => 'xxxx',
    'password' => 'xxxx',
    'trace' => 1,
    'exception' => 0
];

// Make a SOAP request
Request::soap('http://xxxxx/service.svc?wsdl')
    ->headers($headers)
    ->ProductGet(['idProduct' => 4])
    ->done(function ($response) {
        echo '

' , __LINE__ , ": " , print_r($response, true) , '
'; });

HTTP/API GET Request

use ll\Request\Request;

// Make an HTTP GET request
Request::http('http://xxxxx.xxx/xxx/xxx')
    ->headers([
        'Content-Type' => 'application/json'
    ])
    ->get()
    ->done(function ($response) {
        echo '

' , __LINE__ , ": " , print_r($response->meta(), true) , '
'; $decodedResponse = json_decode($response); echo '
' , __LINE__ , ": " , print_r($decodedResponse, true) , '
'; });

HTTP/API POST Request

use ll\Request\Request;

// Make an HTTP POST request
Request::http('http://xxxxx.xxx/xxx/xxx')
    ->headers([
        'Content-Type' => 'application/json'
    ])
    ->post(json_encode(['name' => 'tintim']))
    ->done(function ($response) {
        echo '

' , __LINE__ , ": " , print_r($response->meta(), true) , '
'; $decodedResponse = json_decode($response); echo '
' , __LINE__ , ": " , print_r($decodedResponse, true) , '
'; });

Usage

  • SOAP Request: Use Request::soap($wsdlUrl) to initiate a SOAP request. You can set headers with ->headers($headersArray) and make method calls like ->MethodName($paramsArray).
  • HTTP/API Request: Use Request::http($url) to initiate an HTTP request. Set headers with ->headers($headersArray) and specify the request type (->get(), ->post($data), etc.). Handle the response using the ->done() method.

Notes

  • Ensure that the required dependencies are installed via Composer (ll/request).
  • Replace placeholder values (xxxx, http://xxxxx.xxx/xxx/xxx, etc.) with actual URLs, credentials, and data relevant to your use case.
  • Handle response data within the ->done() callback function, processing it as needed for your application.

For more information and detailed usage instructions, refer to the official llRequest documentation or source repository., (*4)

The Versions

20/02 2017

dev-master

9999999-dev

Pacote para conexão de rests Http e SOAP

  Sources   Download

The Requires

  • php ^5.3.3 || ^7.0

 

20/02 2017

v1

1.0.0.0

Pacote para conexão de rests Http e SOAP

  Sources   Download

The Requires

  • php ^5.3.3 || ^7.0

 

20/02 2017

v0.4-alpha

0.4.0.0-alpha

Pacote para conexão de rests Http e SOAP

  Sources   Download

The Requires

  • php ^5.3.3 || ^7.0