Download the PHP package aegisora/json-rule without Composer

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

Aegisora JSON Rule

Latest Version Total Downloads PHPStan Badge

JSON Rule provides a simple, rule-based JSON 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 webhook payloads, API request bodies, configuration strings, message queue messages, and any other string that must contain well-formed JSON.


๐Ÿ“‘ 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.


๐Ÿ—๏ธ Basic Usage


โœ… Valid vs Invalid

The rule passes for any well-formed JSON value and fails for malformed input. Validation relies on the native JSON parser, so only strictly well-formed JSON is accepted.

Valid JSON

Invalid JSON


๐Ÿงช Validation Result

If the value is valid JSON, the rule returns a valid result.

$result->isValid(); // true

If the value is not valid JSON, the rule returns an invalid result.

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

Aegisora\RuleContract\Exceptions\InvalidRuleContextException


๐Ÿ”— Guardian Usage

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

If the value is not valid JSON, Guardian throws the provided domain exception.


๐Ÿงญ Real-World Examples

JSON Rule is useful for validating string payloads before they are decoded or persisted.

Examples


๐Ÿงฉ Factory Methods

JsonRule::create();

JsonRule::create()->validate($context);


๐Ÿ›๏ธ Architecture

This package relies on aegisora/rule-contract.

Flow:

  1. validate() is called
  2. Context is passed in
  3. The string value is extracted from context (non-strings raise InvalidRuleContextException)
  4. The value is decoded with json_decode()
  5. json_last_error() is checked
  6. Result is returned โ€” valid on success, invalid with the json_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 json-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/json-rule contains the following files

Loading the files please wait ...