This small package offers a simple class to predict if a certain license plate could be on the road based on the timing restrictions of Quitos's transit regulations. Framework agnostic.
Via Composer
$ composer require joelwalls/picoyplaca
Simple usage of the class
require_once "vendor/autoload.php";
$predictor = new JoelWalls\PicoYPlaca\Predictor($license_plate, $date, $time);
if ($predictor->canDrive()) {
echo "Car can be on the road";
} else {
echo "Car cannnot be on the road";
}
The package supports a DateTime instance as second parameter.
require_once "vendor/autoload.php";
use JoelWalls\PicoYPlaca\Predictor;
$predictor = new Predictor($license_plate, new \DateTime);
if ($predictor->canDrive()) {
echo "Car can be on the road";
} else {
echo "Car cannnot be on the road";
}
If needed, you could also especify the timezone of the Predictor object in case the server works with a different TimeZone.
require_once "vendor/autoload.php";
use JoelWalls\PicoYPlaca\Predictor;
$predictor = new Predictor($license_plate, new \DateTime);
$predictor->setTimeZone('America/Guayaquil');
if ($predictor->canDrive()) {
echo "Car can be on the road";
} else {
echo "Car cannnot be on the road";
}
Note: The setTimeZone() method is recommended to use when the Predictor is initialized when a DateTime object as current time.
$ phpunit
The MIT License (MIT). Please see License File for more information.