Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Request Class

Php Request Class Laravel Package

carsdotcom/php-request-class

carsdotcom/php-request-class adds structured request objects to Laravel, letting you wrap input parsing, validation, and typed access in dedicated classes instead of cluttering controllers. Keeps request handling clean, explicit, and easy to test.

View on GitHub
Deep Wiki
Context7

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

Frequently asked questions about Php Request Class
What is carsdotcom/php-request-class used for in Laravel?
It lets you wrap Guzzle API request logic in dedicated request classes, handling input parsing, validation, typed access, response parsing, post-processing, and structured logging. Instead of cluttering controllers with transfer details, you keep HTTP boundary logic explicit and testable. It is aimed at Laravel applications that call external APIs through Guzzle.
How do I install carsdotcom/php-request-class?
Install the package with Composer using composer require carsdotcom/php-request-class, then create request classes that extend the package base and wire them into your application. Check the repository README and release notes for the exact namespace, configuration, and migration steps. Because it wraps Guzzle transfers, confirm your Guzzle version before upgrading.
Does carsdotcom/php-request-class support Laravel 10 or Laravel 11?
The provided context does not list Laravel, PHP, or Guzzle version constraints for the package. You should verify the package composer.json and release notes for supported Laravel, PHP, and Guzzle versions before upgrading. The TPM assessment specifically flags PHP and Guzzle requirements for v2.0.0 as a key question.
How does carsdotcom/php-request-class log Guzzle requests?
Each request writes a structured log entry built from the Guzzle request, the response, the outcome, and request stats. In v2.0.0, the timing of log() invocation and the data appended to that entry changed. Exception messages and extended data can now land in the same log entry as the response body, so review both log parsing and PII exposure.
What changed in v2.0.0 of carsdotcom/php-request-class?
v2.0.0 does not change the package architectural position or the public shape of the log entry, but it does change when log() is invoked and what is appended to it. The release notes call out checks for log() overrides that do not call parent::log(), exception messages and getExtendedData() now appearing in the log entry, non-Throwable postProcess() rejections, and tooling that parses log files structurally. Teams should audit cache-hit logging and expected log volume.
Is postProcess() allowed to reject with a non-Throwable value?
The TPM assessment treats non-Throwable rejection as an open contract question rather than clearly supported behavior, so it may be undefined behavior. A non-Throwable and non-serializable value can make LogFile::put() abort before writing anything, which masks the real failure. Until this is clarified, harden with a defensive wrapper or lint rule and prefer rejecting with Throwable.
How do I test request classes built with carsdotcom/php-request-class?
Because input parsing, validation, response parsing, and post-processing live in dedicated classes, you can unit test them without a full controller or live HTTP stack. Mock Guzzle transfers and assert typed inputs, response parsing, and log behavior. Include tests for cache-hit paths and any log() overrides, since v2.0.0 changes those paths.
What are the production risks of upgrading to carsdotcom/php-request-class v2.0.0?
Two high-severity risks are silent logging failures and new exception or extended data appearing in log entries. A formatting defect in stringify_body() can suppress the entire log entry and replace the real rejection reason, while payload or PII previously confined to exception handling may now reach the log sink. Also watch inflated log volume on high-cache-hit endpoints when log() overrides fire on cache hits.
How can I prevent a single unserializable log section from suppressing the entire log entry?
The TPM assessment highest-value hardening ask is to make stringify_body() non-fatal with per-section try/catch handling inside LogFile::put(). That way an unserializable postProcess() rejection cannot abort the Request/Response section. As a consumer, reject with Throwable and avoid resources, closures, or circular structures in log data.
Is carsdotcom/php-request-class actively maintained, and what alternatives exist?
The provided context does not state maintenance activity, so check GitHub releases, issue activity, and Composer constraints before adopting it. Alternatives include Laravel form requests, HTTP client macros, or custom service classes around Guzzle. This package is specifically useful when you want Guzzle request objects with parsing, post-processing, and structured per-request logging.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core