Download the PHP package hegentopf/php-assert without Composer

On this page you can find all versions of the php package hegentopf/php-assert. 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 php-assert

php-assert

A lightweight and fluent PHP assertion library for easy and expressive validations.


Overview

php-assert is a PHP assertion utility designed to provide an elegant and chainable interface for validating data types, values, and object keys. It supports a variety of common assertions such as type checks, range checks, string validations, date comparisons, and more.

The library throws AssertException on failed assertions, allowing you to handle validation errors cleanly.


Features


Installation

Install via Composer:


Usage


Available Assertions

The following assertions are currently implemented and chainable:


Array and Object Loop Assertions with each() and eachRecursive()

The each() method allows you to apply assertions to every element of an array or every property of an object (only the first level).
The eachRecursive() method applies assertions to every element of an array or every property of an object recursively, including all nested arrays and objects.
This is especially useful when you want to ensure that all values in a (possibly nested) array or object structure meet a specific type or condition.

By default, all properties of an object are validated — including private, protected, and public ones.
If you want to restrict validation to public properties only, you can pass false to the optional $testPrivateProperties parameter.

Note:
Protected properties are treated the same as private ones — they are included by default and excluded only if $testPrivateProperties is set to false.

Examples:

With each() and eachRecursive(), you can chain any assertions and they will be applied to every element in the array or every property in the object (either only the first level or recursively). Optional checks (isOptional()) are correctly propagated to nested arrays and objects.


Testing

Unit tests are provided and use PHPUnit.

To run tests:


License

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


Contribution

Contributions, issues, and feature requests are welcome! Feel free to open a pull request or issue.


Maintainer

Michael Helmert


Thank you for using php-assert!


All versions of php-assert with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
ext-json Version *
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 hegentopf/php-assert contains the following files

Loading the files please wait ...