PHP code example of jeffersongoncalves / laravel-open-hours
1. Go to this page and download the library: Download jeffersongoncalves/laravel-open-hours 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/ */
jeffersongoncalves / laravel-open-hours example snippets
use JeffersonGoncalves\OpenHours\OpenHours;
$hours = app(OpenHours::class);
$hours->isOpen(); // now, in the schedule's timezone
$hours->isOpen($dateTime);
$hours->nextOpen(); // CarbonImmutable|null (null = never opens)
$hours->nextClose(); // CarbonImmutable|null (null = open 24/7)
$hours->statusText(); // "Open now · closes at 18:00", "Closed · opens Monday at 09:00"
$hours->schedule(); // the full Spatie\OpeningHours\OpeningHours instance