Download the PHP package aegisora/regex-rule without Composer

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

Aegisora Regex Rule

Latest Version Total Downloads PHPStan Badge

Regex Rule provides a simple, rule-based regular expression 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, usernames, slugs, email addresses, phone numbers, API request parameters, and any other string that must match a specific pattern.


๐Ÿ“‘ Table of Contents


โœจ Features


๐Ÿ“ฆ Installation


๐Ÿš€ Core Concept

This package implements a single validation rule:

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, and turns PCRE failures into explicit exceptions.


๐Ÿ—๏ธ Basic Usage

The rule can also be instantiated directly:


โœ… Valid vs Invalid

The rule passes when the string matches the configured pattern and fails otherwise.

Anchored patterns

Unanchored patterns

Flags


๐Ÿงช Validation Result

If the string matches the pattern, the rule returns a valid result.

$result->isValid(); // true

If the string does not match the pattern, the rule returns an invalid result.

If the context value is not a string, the rule throws:

Aegisora\RuleContract\Exceptions\InvalidRuleContextException

If the pattern is invalid, or the match fails at runtime (e.g. the backtrack limit is exceeded or the subject is not valid UTF-8 under the u flag), the rule throws:

Aegisora\RuleContract\Exceptions\RuleExecutionException


๐Ÿ”— Guardian Usage

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

If the value does not match the pattern, Guardian throws the provided domain exception.


๐Ÿงญ Real-World Examples

Regex Rule is useful for enforcing format constraints before values are persisted or processed.

Examples


๐Ÿงฉ Factory Methods

RegexRule::create($pattern);

new RegexRule($pattern);

RegexRule::create($pattern)->validate($context);


๐Ÿ›๏ธ Architecture

This package relies on aegisora/rule-contract.

Flow:

  1. validate() is called
  2. Context is passed in
  3. The configured pattern is checked; a broken pattern raises RuleExecutionException
  4. The string value is extracted from context (non-strings raise InvalidRuleContextException)
  5. The value is matched against the pattern with preg_match(); a PCRE runtime failure raises RuleExecutionException
  6. Result is returned โ€” valid on match, invalid with the regex_rule code on no match

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 regex-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/regex-rule contains the following files

Loading the files please wait ...