Download the PHP package shalvah/ensure without Composer
On this page you can find all versions of the php package shalvah/ensure. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download shalvah/ensure
More information about shalvah/ensure
Files in shalvah/ensure
Download shalvah/ensure
More information about shalvah/ensure
Files in shalvah/ensure
Vendor shalvah
Package ensure
Short Description Clean alternative syntax for enforcing business requirements
License MIT
Package ensure
Short Description Clean alternative syntax for enforcing business requirements
License MIT
Please rate this library. Is it a good library?
Informations about the package ensure
ensure ✋🛑
✌🤩🤩Clean alternative syntax for enforcing business requirements. Useful for when your if
s get too clunky.
How to use
-
Specify a requirement using
ensure()
. This rule must either be an expression which evaluates to strict booleantrue
/false
, or a callable which returns strict booleantrue
/false
: -
You can also use
when
before callingensure
, to specify that the rule applies only in certain conditions: - In
orElseDeny()
, specify amessage
and any additionaldata
. This package will throw aRequirementFailedException
with the specified message and data. You can then listen for this in your code (preferably at one central location) and send the appropriate response to the user:
Installation
All versions of ensure with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.6
The package shalvah/ensure contains the following files
Loading the files please wait ....