PHPackages                             mjydh/httpclient - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. mjydh/httpclient

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mjydh/httpclient
================

Paquete de utilidades

v1.0.2(4y ago)017MITPHPPHP &gt;=5.0.0

Since Oct 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ministeriojusticia/httpclient)[ Packagist](https://packagist.org/packages/mjydh/httpclient)[ RSS](/packages/mjydh-httpclient/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependenciesVersions (7)Used By (0)

Ministerio de Justicia y Derecho Humanos.
=========================================

[](#ministerio-de-justicia-y-derecho-humanos)

Repositorio
-----------

[](#repositorio)

Instalación del paquete, por ahora la instalación se realiza manualmente.
-------------------------------------------------------------------------

[](#instalación-del-paquete-por-ahora-la-instalación-se-realiza-manualmente)

Opcion via repositories, agregar al composer.json
-------------------------------------------------

[](#opcion-via-repositories-agregar-al-composerjson)

```
"repositories": [
    {"type": "package",
        "package": {
            "name": "mjydh/httpclientbundle",
            "version": "1.0.2",
            "source": {
                "url": "https://github.com/camposgustavoj/httpclient.git",
                "type": "git",
                "reference": "main"
            }
        }
    }
],

```

ejecutar composer require mjydh/httpclientbundle
------------------------------------------------

[](#ejecutar-composer-require-mjydhhttpclientbundle)

1 - Descargar el proyecto desde
2 - crear la carpeta mjydh dentro de vendor y colocar el paquete descargado dentro.
3 - agregar en el autoload / psr-4 del composer.json del proyecto la referencia al paquete

```
"autoload": {
        "psr-4": {
        "MJYDH\\HttpClientBundle\\": "vendor/mjydh/HttpClientBundle"
    },
},
```

4 - ejecutar

```
composer dump-autoload -o
```

En caso de no poder ejecutar el dump-autoload (como sucede en adminformel y formularioelectronico), se debe agregar en \\vendor\\composer\\autoload\_psr4.php la siguiente linea

```
'MJYDH\\HttpClientBundle\\' => array($vendorDir . '/mjydh/HttpClientBundle'),
```

5 - Symfony &lt; 3.4 Agregar en el AppKernel.php

```
new MJYDH\HttpClientBundle\HttpClientBundle(),
```

5 - Symfony &gt; 4 Agregar en el config/bundles.php

```
MJYDH\HttpClientBundle\HttpClientBundle::class=>['all'=>true]
```

Como implementarlo
------------------

[](#como-implementarlo)

```
// Http client
use MJYDH\HttpClientBundle\Service\HttpClient;
use MJYDH\HttpClientBundle\Exception\HttpException;
use MJYDH\HttpClientBundle\Exception\CatchExceptions;

try
{
    $http = new HttpClient();
    $http->setAuth($user, $pass); //En caso que sea por BASIC AUTH
    $http->setHeaderApiKey($keyValue, "apikey"); //En case que el auto sea por apikey
    //Se agrega al array todos los http_codes que se quieran recortar cuando se llama al Execute();
    $http->setHttpCodeResponses(array(200));
    //Se agregan todos los http_codes que tiran un CatchExceptions
    $http->setCatchExceptions(array(502=> new CatchExceptions("Titulo - Error 502", "Mensaje de error"),
                                    0=> new CatchExceptions("Titulo - Error 502", "Mensaje de error")));

    //Ejecuta el http request y retorna un HttpResult
    $result = $http->Execute('GET', $url);

}
} catch (CatchExceptions $cehttp) {
    return $this->showError($cehttp->getMessage(), $cehttp->getTitle());
}catch (HttpException $ehttp){
    return $this->showError($ehttp->getMessage(), $ehttp->getTitle());
}
```

Fuctions
--------

[](#fuctions)

### setHttpCodeResponses($codesArray)

[](#sethttpcoderesponsescodesarray)

```
 * Setea los http code que debe responder el execute.
 * Los http code que no esten en las lista, los maneja el execute automaticamente.
 *
 * @param $codesArray array("http_code")

```

### setCatchExceptions($catchExceptions)

[](#setcatchexceptionscatchexceptions)

```
 * Setea los http codes y sus respectivos mensajes de error que debe capturarse
 *
 * @param $catchExceptions array("http_code" => "Mensaje de error")

```

Comentarios extras al proyecto
==============================

[](#comentarios-extras-al-proyecto)

Versionado -

Dado un número de versión MAYOR.MENOR.PARCHE, se incrementa:

la versión MAYOR cuando realizas un cambio incompatible en el API, la versión MENOR cuando añades funcionalidad que compatible con versiones anteriores, y la versión PARCHE cuando reparas errores compatibles con versiones anteriores. Hay disponibles etiquetas para prelanzamiento y metadata de compilación como extensiones al formato MAYOR.MENOR.PARCHE.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~119 days

Total

4

Last Release

1302d ago

Major Versions

v1.0.2 → v2.x-dev2022-10-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f495040f6038873c6e46cc5be45706671f674580a56bd3234175ee774c43564?d=identicon)[camposgustavoj](/maintainers/camposgustavoj)

---

Top Contributors

[![ministeriojusticia](https://avatars.githubusercontent.com/u/92804126?v=4)](https://github.com/ministeriojusticia "ministeriojusticia (23 commits)")

### Embed Badge

![Health badge](/badges/mjydh-httpclient/health.svg)

```
[![Health](https://phpackages.com/badges/mjydh-httpclient/health.svg)](https://phpackages.com/packages/mjydh-httpclient)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
