1. Go to this page and download the library: Download webmozart/assert library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
webmozart / assert example snippets
use Webmozart\Assert\Assert;
class Employee
{
public function __construct($id)
{
Assert::integer($id, 'The employee ID must be an integer. Got: %s');
Assert::greaterThan($id, 0, 'The employee ID must be a positive integer. Got: %s');
}
}
new Employee('foobar');
// => Webmozart\Assert\InvalidArgumentException:
// The employee ID must be an integer. Got: string
new Employee(-10);
// => Webmozart\Assert\InvalidArgumentException:
// The employee ID must be a positive integer. Got: -10