2017 © Pedro Peláez
 

library laravel-internal-requests

Make internal requests with your Laravel app

image

matthewbdaly/laravel-internal-requests

Make internal requests with your Laravel app

  • Saturday, November 18, 2017
  • by matthewbdaly
  • Repository
  • 1 Watchers
  • 1 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

laravel-internal-requests

Build Status Coverage Status, (*1)

Make internal requests against your Laravel application., (*2)

Installation

composer require matthewbdaly/laravel-internal-requests

What do I want this for?

I've used this approach for a mobile app that had offline functionality. Every time it made a change to some data, it needed to be able to store the changes locally. Then, when the app was online again, it needed to send the changes up in a batch so that they could be synced. I created a sync endpoint that used something like this to loop through every request in the batch and process it all in one go. If one failed, I could then catch the exception and persist the unsynced changes in a table in the database so that they could be resolved later without losing the data., (*3)

I honestly can't think of any other situation where you'd want to use this approach, but someone else may., (*4)

Usage

Type-hint the interface Matthewbdaly\LaravelInternalRequests\Contracts\Services\MakesInternalRequests to retrieve the internal request service. Then use it as follows:, (*5)

$service->request('POST', '/api/resource', ['content' => 'blah']);

Any one request accepts three arguments:, (*6)

  • The HTTP verb to use
  • The route to hit
  • The payload (optional)

The Versions

18/11 2017

dev-master

9999999-dev

Make internal requests with your Laravel app

  Sources   Download

MIT

The Development Requires

laravel requests internal

18/11 2017