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

On this page you can find all versions of the php package aegisora/numeric-range-rule. 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

Aegisora Numeric Range Rule

Latest Version Total Downloads PHPStan Badge

Numeric Range Rule provides a simple, rule-based numeric range validation implementation for the Aegisora ecosystem.

It is built on top of aegisora/rule-contract and follows its strict validation architecture, ensuring consistent and predictable behavior across applications.

This rule is useful for validating user input, form fields, prices, quantities, ages, percentages, API request parameters, configuration values, and any other numeric value that must satisfy a range boundary.


๐Ÿ“‘ Table of Contents


โœจ Features


๐Ÿ“ฆ Installation


๐Ÿš€ Core Concept

This package implements a single validation rule with several factory variations:

Under the hood it wraps the common boilerplate:

into a reusable rule that reports its outcome through a Result object instead of a raw boolean.


๐Ÿ—๏ธ Basic Usage


โœ… Valid vs Invalid

The rule passes when the numeric value satisfies the configured boundary and fails otherwise. Integers, floats, and numeric strings are all accepted as input.

Lower bound

Upper bound

Range


๐Ÿงช Validation Result

If the value satisfies the boundary, the rule returns a valid result.

$result->isValid(); // true

If the value is out of the boundary, the rule returns an invalid result.

If the context value is not numeric, the rule throws:

Aegisora\RuleContract\Exceptions\InvalidRuleContextException

The same exception is thrown at construction time when the range configuration is impossible, e.g. NumericRangeRule::createBetween(4, 2) ($min > $max) or an empty exclusive range such as NumericRangeRule::createBetweenExclusive(3, 3).


๐Ÿ”— Guardian Usage

This rule can be used together with aegisora/guardian to build fluent validation pipelines.

If the value is out of the allowed boundary, Guardian throws the provided domain exception.


๐Ÿงญ Real-World Examples

Numeric Range Rule is useful for enforcing range constraints before values are persisted or processed.

Examples


๐Ÿงฉ Factory Methods

NumericRangeRule::createGreaterThan($min);

NumericRangeRule::createGreaterThanOrEqualTo($min);

NumericRangeRule::createLessThan($max);

NumericRangeRule::createLessThanOrEqualTo($max);

NumericRangeRule::createBetween($min, $max);

NumericRangeRule::createBetweenExclusive($min, $max);

NumericRangeRule::createBetweenMinExclusive($min, $max);

NumericRangeRule::createBetweenMaxExclusive($min, $max);

NumericRangeRule::createBetween($min, $max)->validate($context);


๐Ÿ›๏ธ Architecture

This package relies on aegisora/rule-contract.

Flow:

  1. validate() is called
  2. Context is passed in
  3. The value is extracted from context (non-numeric values raise InvalidRuleContextException)
  4. The value is compared against the configured boundary
  5. Result is returned โ€” valid on success, invalid with the numeric_range_rule code on failure

All logic is safely handled by Rule contract.


โš–๏ธ 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 with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
aegisora/rule-contract 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 contains the following files

Loading the files please wait ...