PHPackages                             roy404/request - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. roy404/request

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

roy404/request
==============

Request class provides an object-oriented way to interact with the current HTTP request being handled by your application as well as retrieve the input, and files that were submitted with the request.

3.1.7(8mo ago)3205MITPHPPHP ^8.1

Since Feb 18Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/roycanales17/Input-Request)[ Packagist](https://packagist.org/packages/roy404/request)[ RSS](/packages/roy404-request/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (24)Used By (0)

REQUEST CLASS
=============

[](#request-class)

Install the bundle using Composer:

```
composer require roy404/request

```

DOCUMENTATION
=============

[](#documentation)

This PHP class is designed to handle HTTP requests and provide validation and error handling functionalities. It extends the `Blueprints` class and provides methods for validating inputs, accessing request data, and checking for errors.

Usage
-----

[](#usage)

1. **Instantiate the class:** Create an instance of the `Request` class to access its methods.

    ```
    $request = new Request();

    # Access request data: Use the input(), json(), query(), file(), post(), inputs(), has(), method(), only(), and except() methods to access request data.
    $email = $request->input('email');
    $inputs = $request->inputs();
    $hasEmail = $request->has('email');
    $method = $request->method();
    $filteredInputs = $request->only(['email', 'name']);
    $filteredInputs = $request->except(['password']);
    ```
2. **Validate inputs:** Use the validate() method to specify validation rules and the isSuccess() and isFailed() methods to check if validation was successful.

    ```
    $request->validate([
        'email' => 'required|email',
        'file' => 'required|file|extensions:xlsx,pdf|max:200',
        'images' => 'required|image|dimensions:max_width=1800,max_height=1500'
    ]);

    if ($request->isSuccess()) {
        // Validation successful
    } else {
        // Validation failed
        $errors = $request->errors();
    }
    ```
3. **Set custom error messages:** Use the message() method before the isSuccess() and isFailed() to set custom error messages for validation rules.

    ```
    $request->message([
        'email' => [
            'required' =>  'Email address is required.'
        ],
        'file' => [
            'required' => 'Please upload a file.'
        ]
    ]);
    ```

Available Methods
-----------------

[](#available-methods)

- `inputs(): array`: Get all input values.
- `input(string $name): mixed`: Get the value of a specific input.
- `has(string $key): bool`: Check if an input exists.
- `method(): string`: Get the HTTP request method.
- `only(array $input_keys): array`: Get only the specified input values.
- `except(array $input_keys): array`: Get all input values except the specified keys.
- `errors(bool $force_all = false): array`: Get validation errors.
- `error(string $key): mixed`: Get the error message for a specific input key.
- `isMatched(string $key, mixed $value): bool`: Check if the input value matches the specified value.
- `isSuccess(): bool`: Check if validation was successful.
- `isFailed(): bool`: Check if validation failed.
- `validate(array $array): self`: Set validation rules.
- `message(array $array): void`: Set custom error messages.

Validation Rules
----------------

[](#validation-rules)

- `image`: Ensures that the input is a valid image file, such as JPEG, PNG, GIF, SVG, or WEBP.
- `file`: Validates that the input is a valid file upload.
- `required`: Checks that the input is not empty.
- `array`: Verifies that the input is an array.
- `null`: Checks that the input is null.
- `numeric`: Ensures that the input is a numeric value.
- `integer`: Checks that the input is an integer.
- `string`: Verifies that the input is a string.
- `email`: Validates that the input is a valid email address.
- `password`: Validates that the input is a valid password.
- `confirmed`: Checks that the input value matches another field (typically used for password confirmation).
- `mimes`: Specifies the allowed MIME types for file uploads, such as JPEG, PNG, PDF, etc.
- `extensions`: Specifies the allowed file extensions for file uploads, such as pdf, xlsx, etc.
- `max`: Specifies the maximum file size in MB allowed for file uploads or the maximum characters length for strings.
- `min`: Specifies the minimum characters length for strings.
- `dimensions`: Validates the dimensions (width and height) of an image file, enforcing minimum or maximum width and height requirements for images. It supports options like `max_width`, `max_height`, `min_width`, `min_height`, `width`, and `height`.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance60

Regular maintenance activity

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Every ~28 days

Recently: every ~0 days

Total

23

Last Release

253d ago

Major Versions

1.0.2 → v2.02024-10-04

v2.0 → v3.0.02025-01-17

PHP version history (2 changes)1.0.0PHP ^8.0

v3.1.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/542567e23f273798a0a4a752804c792654fe6c3753b53752b1d00b7eff2b8b11?d=identicon)[roycanales](/maintainers/roycanales)

---

Top Contributors

[![roycanales17](https://avatars.githubusercontent.com/u/62797701?v=4)](https://github.com/roycanales17 "roycanales17 (30 commits)")

---

Tags

error-handlinghttp-headersinput-fetchinginput-requestrequest-headersrequest-validationresponse-generatorresponse-handlingvalidationphpplugins

### Embed Badge

![Health badge](/badges/roy404-request/health.svg)

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

###  Alternatives

[laracraft-tech/laravel-xhprof

Easy XHProf setup to profile your laravel application!

235358.7k](/packages/laracraft-tech-laravel-xhprof)[noisebynorthwest/php-spx

A simple &amp; straight-to-the-point PHP profiling extension with its built-in web UI

2.6k2.6k](/packages/noisebynorthwest-php-spx)[bavix/laravel-xhprof

Quick profiling of your code for Laravel

22157.5k](/packages/bavix-laravel-xhprof)[h4cc/phpqatools

A meta composer package for PHP QA Tools.

6418.6k1](/packages/h4cc-phpqatools)[thehocinesaad/laravel-error-ai

This package adds Ask AI button to the error page.

2226.9k](/packages/thehocinesaad-laravel-error-ai)

PHPackages © 2026

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