joelwalls/picoyplaca

This simple package predicts if a given license place can be on the road at a certain date and time based on Quito restrictions.

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/joelwalls/picoyplaca

v1.0.2 2020-04-22 15:26 UTC

This package is auto-updated.

Last update: 2025-09-23 04:19:59 UTC


README

Latest Version Software License Build Status Total Downloads

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.

Install

Via Composer

$ composer require joelwalls/picoyplaca

Usage

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.

Testing

$ phpunit

Credits

License

The MIT License (MIT). Please see License File for more information.