1. Go to this page and download the library: Download koen/opening-hours-library 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/ */
koen / opening-hours-library example snippets
$openingHours = new OpeningHours();
$openingHours->setOpeningTime($openAt);
$openingHours->setClosingTime($closedAt);
$pause = new Pause($pauseStart, $pauseEnd);
$openingHours = new OpeningHoursWithBreaks();
$openingHours->setOpeningTime($openAt);
$openingHours->setClosingTime($closedAt);
$openingHours->addPause($pause, $pause, ...);
class Controller {
private $validator;
public function __construct(
ValidateOpeningHoursInterface $validator
) {
$this->validator = $validator;
}
public function yourControllerLogic()
{
$openingHours = new OpeningHours();
...
$this->validator->validate($openingHours);
}
}
$openingHours = new OpeningHoursWithBreaks();
$validator = new ValidateOpeningHours();
$validator->validate($openingHours);
$validator = new PauseValidator();
$validator->validate($openingHours);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.