Download the PHP package joebengalen/assert without Composer

On this page you can find all versions of the php package joebengalen/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 Coverage Status SensioLabsInsight Total Downloads

As we all know when using an existing library we wish some things would be a little different. To make sure I can use assertions exactly how I feel is best, I created my own implementation.

The assert methods are meant to be used to check whether incoming arguments are what you expect them to be. If the variable does not meet the assertion an InvalidArgumentException is thrown.

I needed all available assertions to be actual methods instead of virtual ones in the class PHPDoc, because virtual ones do not work properly with static methods in netbeans.

Installation

Via Composer

Usage

Custom exception messages

Sometimes you may want to throw the exception with a different message. This can be done by passing a second string argument into the assertion method.

The error messages are run trough sprintf(), where the passed variable, transformed into a useful string, will be available.

Some assertion methods take additional arguments which are needed for the assertion. The custom message shall always be the latest argument. Additional arguments will also be passed into sprintf(), in the order of the arguments. This means the value to assert will always be the first string passed into sprintf().

If you want to use the arguments in a different order in the message you can swap them by referring to their number.

For more information on swapping the arguments checkout the php documentation of sprintf().

Change log

Please see the CHANGELOG for more information what has changed recently.

Testing

This project uses PHPUnit for testing. PHPUnit is not included as requirement, so to run the tests phpunit has to be manually installed. The reason for this is that I prefer having phpunit installed globally.


All versions of assert with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
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 joebengalen/assert contains the following files

Loading the files please wait ....