PHPackages                             nathanmac/laravel-restclient - 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. [API Development](/categories/api)
4. /
5. nathanmac/laravel-restclient

ActiveLibrary[API Development](/categories/api)

nathanmac/laravel-restclient
============================

Simple RestClient for Laravel 4

293.2k17[2 issues](https://github.com/nathanmac/laravel-restclient/issues)PHP

Since Jan 16Pushed 9y ago2 watchersCompare

[ Source](https://github.com/nathanmac/laravel-restclient)[ Packagist](https://packagist.org/packages/nathanmac/laravel-restclient)[ RSS](/packages/nathanmac-laravel-restclient/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-restclient
==================

[](#laravel-restclient)

[![Build Status](https://camo.githubusercontent.com/ab2eb0e48aa2305adfd6f0e6a372b8f22426f3f478a0982570e923aa9016af8f/68747470733a2f2f7472617669732d63692e6f72672f6e617468616e6d61632f6c61726176656c2d72657374636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nathanmac/laravel-restclient)[![Still Maintained](https://camo.githubusercontent.com/7084bf4b9909ad764541a1a98cad606416bcd653cd32ed1b01aa66e100c480ca/687474703a2f2f7374696c6c6d61696e7461696e65642e636f6d2f6e617468616e6d61632f6c61726176656c2d72657374636c69656e742e706e67)](http://stillmaintained.com/nathanmac/laravel-restclient)

Simple RestClient Package for Laravel 4

Installation
------------

[](#installation)

Begin by installing this package through Composer. Edit your project's `composer.json` file to require `Nathanmac/laravel-restclient`.

```
"require": {
	"nathanmac/laravel-restclient": "dev-master"
}

```

Next, update Composer from the Terminal:

```
composer update

```

Once this operation completes, the final step is to add the service provider. Open `app/config/app.php`, and add a new item to the providers array.

```
'Nathanmac\RestClient\RestClientServiceProvider'

```

##### Calling an Endpoint

[](#calling-an-endpoint)

```
try {
    $response = RestClient::get('hostname:port/endpoint');
} catch (Exception $ex) {
    print "Error: " . $ex->getMessage(); // Error: COULDNT_RESOLVE_HOST
}
```

###### HTTP Methods

[](#http-methods)

```
  $response = RestClient::get('hostname:port/endpoint');
  $response = RestClient::post('hostname:port/endpoint', 'payload data');
  $response = RestClient::put('hostname:port/endpoint', 'payload data');
  $response = RestClient::delete('hostname:port/endpoint');
```

###### Adding HTTP Headers

[](#adding-http-headers)

```
$headers = array(
    'token: SLDKFJLKSDFJSLDFJ',
    'other: asfasdfasdf'
);

$response = RestClient::get('hostname:port/endpoint', $headers);
$response = RestClient::post('hostname:port/endpoint', 'payload data', $headers);
$response = RestClient::put('hostname:port/endpoint', 'payload data', $headers);
$response = RestClient::delete('hostname:port/endpoint', $headers);
```

##### Get the HTTP Status Code

[](#get-the-http-status-code)

```
echo "HTTP Status Code: " . $response->getStatusCode(); // HTTP Status Code: 200
echo "HTTP Status Text: " . $response->getStatusText(); // HTTP Status Text: OK
```

##### Returning the response content

[](#returning-the-response-content)

```
print $response->getContent();
```

##### Returning the response headers

[](#returning-the-response-headers)

```
print_r($response->getHeaders());
```

##### Returning a specific header

[](#returning-a-specific-header)

```
echo "Content-Type: " . $response->getHeader('content_type'); // Content-Type: application/json
```

##### Returning the response time (seconds)

[](#returning-the-response-time-seconds)

```
echo "Time: " . $response->getTime();  // Time: 0.23453
```

##### Adding custom cURL options for every request

[](#adding-custom-curl-options-for-every-request)

At the beginning publish the config file:

```
php artisan config:publish nathanmac/laravel-restclient

```

Then edit the `options` array in `app/config/packages/nathanmac/laravel-restclient/config.php`.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.8% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e938d7304b579f1f6ba7895dcee6b7b95eeb7f7aed77be6e4bcce777eb9e0245?d=identicon)[nathanmac](/maintainers/nathanmac)

---

Top Contributors

[![nathanmac](https://avatars.githubusercontent.com/u/3205902?v=4)](https://github.com/nathanmac "nathanmac (7 commits)")[![deusxyz](https://avatars.githubusercontent.com/u/4669692?v=4)](https://github.com/deusxyz "deusxyz (2 commits)")[![pjona](https://avatars.githubusercontent.com/u/170732?v=4)](https://github.com/pjona "pjona (2 commits)")[![abelorosz](https://avatars.githubusercontent.com/u/620148?v=4)](https://github.com/abelorosz "abelorosz (1 commits)")[![mskiba](https://avatars.githubusercontent.com/u/460870?v=4)](https://github.com/mskiba "mskiba (1 commits)")

### Embed Badge

![Health badge](/badges/nathanmac-laravel-restclient/health.svg)

```
[![Health](https://phpackages.com/badges/nathanmac-laravel-restclient/health.svg)](https://phpackages.com/packages/nathanmac-laravel-restclient)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M474](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

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