PHP code example of pierswarmers / mandate
1. Go to this page and download the library: Download pierswarmers/mandate 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/ */
pierswarmers / mandate example snippets
use ManDate\Mandate;
use ManDate\Rule\WeekdayRule;
use ManDate\Rule\DaytimeRule;
use ManDate\Rule\MorningRule;
$mandate = new Mandate();
$mandate
->andWhere(new WeekdayRule())
->andWhere(new DaytimeRule())
->andWhereNot(new MorningRule())
;
$date = new \DateTime('2015-03-02 11:30', new \DateTimeZone('Australia/Sydney'));
if ($mandate->validate($date)) {
echo 'It\'s a weekday afternoon!';
}