PHP code example of insight-media / statamic-opening-hours

1. Go to this page and download the library: Download insight-media/statamic-opening-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/ */

    

insight-media / statamic-opening-hours example snippets

 bash
php artisan vendor:publish --tag=statamic-google-opening-hours-config --force
 antlers
{{ if {openingHours:isOpen at="2022-12-31 15:00:00"} }}
    We are open on 2022-12-31 at 15:00:00
{{ /if }}
 antlers
{{ if {openingHours:isClosed on="2023-01-02"} }}
    We are closed on 2023-01-02
{{ /if }}
 antlers
{{ if {openingHours:isClosed at="2022-12-31 22:00:00"} }}
    We are closed on 2022-12-31 at 22:00:00
{{ /if }}
 antlers
{{ openingHours:diffInOpenHours from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}
 antlers
{{ openingHours:diffInOpenMinutes from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}
 antlers
{{ openingHours:diffInOpenSeconds from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}
 antlers
{{ openingHours:diffInClosedHours from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}
 antlers
{{ openingHours:diffInClosedMinutes from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}
 antlers
{{ openingHours:diffInClosedSeconds from="2022-12-21 10:00:00" to="2022-12-21 13:00:00" }}