Download the PHP package simplesamlphp/assert without Composer

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

Assert

Build Status Scrutinizer Code Quality Coverage Status PHPStan Enabled

Background

A wrapper around webmozart/assert to make it useful beyond checking method arguments. One of the major reasons to come up with this fork was our requirement to be able to throw custom exceptions, instead of everything being thrown as a generic InvalidArgumentException.

Using a __callStatic wrapper we are able to wrap the webmozart-methods allowing for an extra exception parameter, and catch the InvalidArgumentException by the original library, then throw the desired exception, or fall back to our custom AssertionFailedException.

In practise, this means that every assertion provided by the original library can be used an provided with an additional parameter. If you provide it, and it translates into a Throwable class, that is what will be thrown as soon as the assertion fails. If you don't pass the the extra parameter, we will throw the more generic AssertionFailedException (which in our opinion is still better than the even more generic InvalidArgumentException).

We also felt that InvalidArgumentException is incorrect to use in this case. This exception was intended by PHP to be thrown when a function parameter is of the wrong type. Our custom AssertionFailedException therefore inherits from UnexpectedValueException which is intended to verify values against valid value sets, possibly during the internal computations of a function. We deem this much more appropriate for use in assertions.

Custom Assertions

Another reason to fork is the ability to add a few custom assertions that may only make sense for XML / SAML2 related things.

Currently this library provides the following additional assertions:

Assertions

Method Description
stringPlausibleBase64($value, $message = '') Check that a value is plausibly base64
validDateTime($value, $message = '') Check that a value is a valid ISO8601 compliant DateTime
notInArray($value, $values, $message = '') Check that a value is NOT one of a list of values
validURI($value, $message = '') Check that a value is a valid RFC3986 URI
validURL($value, $message = '') Check that a value is a valid RFC2396 URL
validURN($value, $message = '') Check that a value is a valid RFC8141 URN
validNCName($value, $message = '') Check that a value is a valid xs:NCName
validQName($value, $message = '') Check that a value is a valid xs:QName
validDuration($value, $message = '') Check that a value is a xs:duration

All versions of assert with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-date Version *
ext-filter Version *
ext-pcre Version *
ext-spl Version *
league/uri-interfaces Version ^7.4
webmozart/assert Version ^1.11
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 simplesamlphp/assert contains the following files

Loading the files please wait ....