New

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

carsdotcom/php-request-class

Structure the logic around Guzzle API requests into object-oriented classes
32,062 2
Install
composer require carsdotcom/php-request-class
Latest Version:v2.0.0
PHP:^8.1
Laravel:9 – 13
License:MIT
Last Updated:Aug 15, 2026
Links: GitHub  ·  Packagist
Maintainer: jwadhams

php-request-class

Structure the logic around Guzzle API requests into object-oriented classes

What?

We maintain an application that is reliant on dozens of REST APIs, most of which do not have SDKs.

We love Guzzle! But most of the documentation assumes that making a request is "easy," just a few lines of code.

But we've discovered in our own use that the structure around that Guzzle request can run into hundreds of lines, managing pre-requisites like authentication, converting data between our internal types and our partners' types, etc.

So we created AbstractRequest as a standardized way to:

  1. Organize logic into classes.
  2. Provide swappable traits for encoding and decoding (XML, JSON, forms, even simplified GraphQL!)
  3. Log everything using Laravel's File facade
  4. Cache using Laravel's Cache facade (with a simple automatic cache key generator)
  5. Provide a structure for chainable prerequisites (like authentication)
  6. Provide a structure for catching exceptions and parsing responses back into your internal logic
  7. Let you defer decisions about call order or synchronous/asynchronous processing to the user of the request class

Running the Tests

Install the dev dependencies:

composer install

Then run phpunit from the root of the project:

./vendor/bin/phpunit

Related Packages

valorin/random

Random is a simple helper package designed to make it easy to generate a range o...

413,065 233
php
cline/variable-keys

Laravel Blueprint macros for variable primary key and morph types

22,912 0
php
cline/struct

Lean, attribute-driven Laravel data objects with explicit validation and Eloquen...

17,788 0
php
cline/toggl

Advanced feature flag management with strategies, time bombs, and groups

12,171 0
php
cline/sequencer

Sequential migration and operation orchestration for Laravel

11,736 0
php

Version History

Version Released PHP Laravel License
v2.0.0 ^8.1 ^9.19 || ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
v1.9.0 ^8.1 ^9.19 || ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
v1.8.0 ^8.1 ^9.19 || ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
v1.7.4 ^8.1 ^9.19 || ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
v1.7.3 ^8.1 ^9.19 || ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT