Search by

wexample / symfony-check

weeger

Non-blocking checks on any object: checkers report findings with a severity, aggregated per subject

Package info

github.com/wexample/symfony-check

pkg:composer/wexample/symfony-check

Statistics

Installs: 21

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

3.0.0 2026-10-08 10:56 UTC

This package is auto-updated.

Last update: 2026-10-08 10:56:30 UTC


README

Version: 3.0.0

Checkers

final class OrderChecker implements CheckerInterface
{
    public function supports(object $subject): bool { return $subject instanceof Order; }

    public function check(object $subject): iterable
    {
        if ($subject->isOverpaid()) {
            yield Finding::error('order.overpaid', ['excess' => $subject->getExcess()]);
        }
    }
}

Implementing the interface registers it. A finding's code is a translation key, its parameters fill it; severities are info, warning and error.

CheckService::check($subject) and checkAll($subjects) return a CheckReport: findings per subject, filtered by severity, counted by severity or code.

In bulk

A SubjectProviderInterface names a set of subjects; bin/console check:run [provider] --min-severity=warning --fail-on=error --format=json checks them and fails when a finding reaches --fail-on, for a cron to alert on.

Before stopping the application

Class\Shutdown is the application about to be stopped — for a release, a maintenance, a server going down —, the one subject of the shutdown provider. Each package that runs something a stop would cut short — a payment a provider has yet to confirm, a job half done — supports it with a checker, an error coded shutdown.locked.<what> while it is busy:

public function supports(object $subject): bool { return $subject instanceof Shutdown; }

public function check(object $subject): iterable
{
    if ($count = $this->payments->countInFlight()) {
        yield Finding::error('shutdown.locked.payments_in_flight', ['count' => $count]);
    }
}

A script stopping the application calls, first, and waits or gives up while it fails:

bin/console check:run shutdown

Table of Contents

Integration in the Suite

This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.

Related Packages

The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.

Visit the Wexample Suite documentation for the complete package ecosystem.

Dependencies

  • php: >=8.5
  • wexample/symfony-helpers: >=15.0.0

Versioning & Compatibility Policy

Wexample packages follow Semantic Versioning (SemVer):

  • MAJOR: Breaking changes
  • MINOR: New features, backward compatible
  • PATCH: Bug fixes, backward compatible

We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Free to use in both personal and commercial projects.

About us

Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.

This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.

Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.

Migration Notes

When upgrading between major versions, refer to the migration guides in the documentation.

Breaking changes are clearly documented with upgrade paths and examples.