PHPackages                             teepluss/consume - 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. teepluss/consume

ActiveLibrary[API Development](/categories/api)

teepluss/consume
================

Retrieving data from a REST api without HTTP request.

1.0.0(9y ago)438MITPHPPHP &gt;=5.5.9

Since Dec 9Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

Consume Laravel REST api without HTTP request.
----------------------------------------------

[](#consume-laravel-rest-api-without-http-request)

Consume your own API from the same application without request via HTTP protocol

### Installation

[](#installation)

- [Consume on Packagist](https://packagist.org/packages/teepluss/consume)
- [Consume on GitHub](https://github.com/teepluss/laravel-consume)

To get the latest version of `Consume` simply require it in your `composer.json` file.

```
"teepluss/consume": "^1.0.0"

```

You'll then need to run `composer install` to download it and have the autoloader updated.

Once Consume is installed you need to register the service provider with the application. Open up `config/app.php` and find the `providers` key.

```
'providers' => [

    Teepluss\Consume\ConsumeServiceProvider::class,

]

```

Consume also ships with a facade which provides the static syntax for creating collections. You can register the facade in the `aliases` key of your `config/app.php` file.

```
'aliases' => [

    'Consume' => Teepluss\Consume\Facades\Consume::class,

]

```

Usage
-----

[](#usage)

```
$accessToken = "[YOUR_ACCESS_TOKEN]";

// File uploading.
$userfile = request()->file('userfile');

// POST parameters.
$parameters = [
    'name'     => 'Teepluss',
    'userfile' => $userfile
];

try {
    $request = Consume::asJson()
                      ->withAccessToken($accessToken)
                      ->request('POST', '/api/user', $parameters)
                      ->send();

    $response = $request->getContent();
} catch (\Teepluss\Consume\Exception\ErrorException $e) {
    // This may return laravel validation error.
    $response = $e->getContent();
} catch (\Teepluss\Consume\Exception\NotFoundException $e) {
    $response = 'Not Found Exception';
}
```

Problem
-------

[](#problem)

If you are sending file upload to the REST api you need to get file directly.

```
// Not work
request()->file('userfile');

// work
request()->files->get('userfile');
```

Support or Contact
------------------

[](#support-or-contact)

If you have any problems, Contact

[![Support via PayPal](https://camo.githubusercontent.com/1c4c2a63b268ab949717893dda9628735444f61b8eb8eece283a534338b5b0e5/68747470733a2f2f7261776769746875622e636f6d2f63687269732d2d2d2f446f6e6174696f6e2d4261646765732f6d61737465722f70617970616c2e6a706567)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9GEC8J7FAG6JA)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

3444d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98f73b54567183f49c41533fc0c05cfffccdf5ed4f0351e3065d62d14779d26f?d=identicon)[teepluss](/maintainers/teepluss)

---

Tags

laravelrestfulconsume

### Embed Badge

![Health badge](/badges/teepluss-consume/health.svg)

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

###  Alternatives

[api-ecosystem-for-laravel/dingo-api

A RESTful API package for the Laravel and Lumen frameworks.

3121.5M10](/packages/api-ecosystem-for-laravel-dingo-api)[obiefy/api-response

Simple Laravel package to return Json responses.

17324.6k](/packages/obiefy-api-response)[laravie/api

A RESTful API package for the Laravel and Lumen frameworks.

1624.4k1](/packages/laravie-api)

PHPackages © 2026

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