New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

teepluss/consume

Retrieving data from a REST api without HTTP request.
38 4

Larablocks Analysis

teepluss/consume works with Laravel 5 (latest release 1.0.0, Dec 9, 2016), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: Dec 9, 2016)
  • 0 downloads a month (needs 10,000)
  • 4 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Dec 9, 2016.
  • No releases in the last 12 months.
  • First released: Dec 9, 2016.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require teepluss/consume
Latest Version:1.0.0
PHP:>=5.5.9
Laravel:5
License:MIT
Last Updated:Dec 9, 2016
Links: GitHub  ·  Packagist
Maintainer: teepluss

Consume Laravel REST api without HTTP request.

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

Installation

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

$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

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

If you have any problems, Contact teepluss@gmail.com

Support via PayPal

Related Packages

baijunyao/laravel-restful

Laravel Restful

19,140 1
teepluss/restable

Laravel RESTful API format

69,508 69
onex/espier

A RESTful API Package for lumen

15 0
api-ecosystem-for-laravel/dingo-api

A RESTful API package for the Laravel and Lumen frameworks.

2,048,277 318
laravie/api

A RESTful API package for the Laravel and Lumen frameworks.

24,514 14

Version History

Version Released PHP Laravel License
1.0.0 >=5.5.9 >=5.1.0 MIT