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 Checker Laravel Package

ixnode/php-checker

ixnode/php-checker is a lightweight PHP package offering reusable checker utilities for validating common data types and conditions. Its simple, focused methods help keep validation logic clean, readable, and consistent across Laravel and plain PHP projects.

View on GitHub
Deep Wiki
Context7

Getting Started

Install with Composer:

composer require ixnode/php-checker

There is no Laravel service provider or config file to publish — this is a plain PHP validation/checker library. Start by reading vendor/ixnode/php-checker/README.md and the checker classes under vendor/ixnode/php-checker/src/. Look first at CheckerArray because 0.1.8 changes its public API.

First practical use case: guard array shape before processing request data. For example, ensure a payload is a sequential list before passing it to a batch job:

use Ixnode\PhpChecker\CheckerArray;

$checker = new CheckerArray();
$checker->checkSequential($payload); // throws on failure

In 0.1.8, the old checkSimple() and checkIndexArraySimple() methods were renamed to checkSequential() and checkIndexArraySequential(). If you are starting fresh, use the new names; if you are upgrading, update every call site.

Implementation Patterns

Use the checker at the boundary where untyped data enters your domain — form requests, API controllers, queue jobs, or import services. A common Laravel pattern is to wrap the checker in a custom validation rule so failures become normal validation errors:

use Illuminate\Contracts\Validation\Rule;
use Ixnode\PhpChecker\CheckerArray;

class SequentialArrayRule implements Rule
{
    public function passes($attribute, $value): bool
    {
        try {
            (new CheckerArray())->checkSequential($value);
            return true;
        } catch (\Throwable $e) {
            return false;
        }
    }

    public function message(): string
    {
        return 'The :attribute must be a sequential array.';
    }
}

For associative arrays with integer keys, use checkIndexArraySequential() after the rename. Keep checker usage close to the data source: validate in a form request, then pass already-checked arrays into services. Avoid scattering checker calls deep in your domain unless the data can originate from multiple untrusted sources.

Integration tips:

  • Use the checker for structural array checks; keep Laravel’s native validation for scalar rules (required, string, max, etc.).
  • Convert checker exceptions to ValidationException in HTTP contexts so clients receive a 422 response instead of a 500.
  • In console commands and jobs, let the exception bubble up or catch it and log a clear domain-specific message.
  • If you need reusable checks, create small Laravel rule classes or helper functions rather than repeating try/catch blocks.

Gotchas and Tips

  • 0.1.8 is a breaking rename. CheckerArray::checkSimple() is now checkSequential(), and checkIndexArraySimple() is now checkIndexArraySequential(). There are no compatibility aliases in the release notes, so search your codebase for the old method names before upgrading. Pin ixnode/php-checker to ^0.1.8 only after updating call sites.
  • Checker methods generally signal failure by throwing an exception. In Laravel, uncaught exceptions become 500 errors by default, so wrap checker calls in form requests/rules or catch and convert them to ValidationException.
  • There is no Laravel-specific configuration or service provider. Debugging is mostly reading the checker source and the exception message. If a check fails unexpectedly, dump the input array with json_encode() or var_export() to confirm whether keys are sequential or associative.
  • Extension points are limited: subclass a checker or wrap it in your own rule/helper. Do not expect Laravel container bindings or facades.
  • Because the package is small, prefer native Laravel validation for simple cases and reach for php-checker when you need explicit array-shape checks that are awkward to express with array rules.
  • When upgrading from 0.1.7 or earlier, run a project-wide search for checkSimple and checkIndexArraySimple, update tests, and verify any custom rules that reference those methods.
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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle