impulzo/rest_client_service

Cliente de Servicios REST Para Laravel

Installs: 305

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:HTML

pkg:composer/impulzo/rest_client_service

v2.0.0 2023-05-22 19:08 UTC

This package is auto-updated.

Last update: 2025-11-23 01:16:41 UTC


README

Servicio de Cliente Rest para Laravel

  • In the new version remplace RestClientFacade for RestClient.
  • Versión 2.0 - 22 May 2023 deployed in master.

Installation

On Laravel And Lumen

edit composer.json, add line in require:

"impulzo/rest_client_service": "dev-master",

or execute

  composer require impulzo/rest_client_service

Setting

Laravel

Add config/app.php

  \Impulzo\RestClientService\RestClientServiceProvider::class

Lumen

Add bootstrap/app.php

  $app->register(\Impulzo\RestClientService\RestClientServiceProvider::class);

Use

import

  use Impulzo\RestClientService\Libraries\RestClient;

and

  //Inyect Dependency
  public function methodName(RestClient $service){
    ....
  }
  
  //or
  
  //Create Class
  public function methodName(){
    $service = new RestClient();
  }

GET headers is optional, default null

  $service->get($url, $headers);

POST

  • headers is optional,headers is default null
  • $data becomes default json_encode
  • if you send headers json_encode is not applied
  $service->post($url, $data , $header);

PUT and DELETE The same rules apply of method POST

  $service->put($url, $data , $headers);
  
  //or
  
  $service->delete($url, $data , $headers);