Download the PHP package aegisora/numeric-range-rule-guardian without Composer

On this page you can find all versions of the php package aegisora/numeric-range-rule-guardian. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package numeric-range-rule-guardian

Aegisora Numeric Range Rule Guardian

Latest Version Total Downloads PHPStan Badge

Numeric Range Rule Guardian provides simple shortcuts for ensuring a numeric value falls within an expected range using aegisora/guardian and aegisora/numeric-range-rule.

It is designed for cases where you want to quickly check whether a value is greater than, less than, or between given bounds without manually creating validation pipelines.

This package is built on top of:


โœจ Features


๐Ÿ“ฆ Installation


๐Ÿš€ Core Concept

This package wraps the common validation flow:

into a dedicated shortcut class:

Instead of manually creating NumericRangeRule and passing it to Guardian, you can use NumericRangeRuleGuardian directly.


๐Ÿ—๏ธ Basic Usage


๐Ÿงฉ Usage with Custom Exception

You may provide your own exception for validation failure.

If the value is out of the range, the provided exception will be thrown.

This is useful when validation errors should have domain-specific meaning.


๐Ÿงช Example in Application Service


๐Ÿšจ Exceptions

This package does not define its own exception types. All errors are raised by the underlying aegisora/guardian package.

Both exceptions extend the abstract base class Aegisora\Guardian\Exceptions\GuardianException, so you can catch every validation error with a single catch:

GuardianValidationException

Thrown when validation fails and no custom exception is provided.

GuardianExecutingRuleException

Thrown when the underlying rule execution fails, for example when the checked value is not numeric.

Aegisora\Guardian\Exceptions\GuardianExecutingRuleException


๐Ÿงฉ API

All methods share the same contract: they return void and communicate results through exceptions only โ€” nothing is returned on success and an exception is thrown on failure:

Each method also throws Aegisora\RuleContract\Exceptions\InvalidRuleContextException when the range is configured with invalid bounds (a non-numeric bound, $min greater than $max, or equal bounds where at least one side is exclusive).

NumericRangeRuleGuardian::checkGreaterThan()

Valid when $value > $min.

NumericRangeRuleGuardian::checkGreaterThanOrEqualTo()

Valid when $value >= $min.

NumericRangeRuleGuardian::checkLessThan()

Valid when $value < $max.

NumericRangeRuleGuardian::checkLessThanOrEqualTo()

Valid when $value <= $max.

NumericRangeRuleGuardian::checkBetween()

Valid when $min <= $value <= $max (both bounds inclusive).

NumericRangeRuleGuardian::checkBetweenExclusive()

Valid when $min < $value < $max (both bounds exclusive).

NumericRangeRuleGuardian::checkBetweenMinExclusive()

Valid when $min < $value <= $max (lower bound exclusive, upper bound inclusive).

NumericRangeRuleGuardian::checkBetweenMaxExclusive()

Valid when $min <= $value < $max (lower bound inclusive, upper bound exclusive).

Common parameters:

Example:

With custom exception:


๐Ÿ›๏ธ Architecture

This package is a small shortcut layer over the Aegisora validation pipeline.

Flow:

  1. A NumericRangeRuleGuardian::check*() method is called
  2. The matching NumericRangeRule::create*() rule is created
  3. Guardian executes the rule
  4. If validation succeeds, execution continues normally
  5. If validation fails, custom exception or GuardianValidationException is thrown
  6. If rule execution fails, GuardianExecutingRuleException is thrown

Internal flow:


๐Ÿ”— Related Packages


โš–๏ธ License

This package is open-source and licensed under the MIT License. See the LICENSE for details.


๐ŸŒฑ Contributing

Contributions are welcome and greatly appreciated!. See the CONTRIBUTING for details.


๐ŸŒŸ Support

If you find this project useful, please consider giving it a star on GitHub!

It helps the project grow and motivates further development.



All versions of numeric-range-rule-guardian with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
aegisora/guardian Version ^1.0
aegisora/numeric-range-rule Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aegisora/numeric-range-rule-guardian contains the following files

Loading the files please wait ...