PHP code example of bramdeleeuw / silverstripe-openinghours

1. Go to this page and download the library: Download bramdeleeuw/silverstripe-openinghours 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/ */

    

bramdeleeuw / silverstripe-openinghours example snippets


// Returns the opening hours as a summarized list, this means days with similar opening hours are combined e.g "Mon – Tue"
$openingHourHolder->getOpeningHoursSummarized()
 
// Returns todays opening hours
$openingHourHolder->getOpeningHoursToday()
 
// Return the short localized version for the current day (in the loop)
$openingHour->getShortDay();
 
// Return the short localized version for the current day (in the loop)
$openingHour->getFullDay();
 
// Return the concatnated days list as a range, only used when looping over the summarized days loop.
$openingHour->getConcatenatedDays();
 
// Returns true when the From and Till data are equal (shop is closed for that day)
$openingHour->IsClosed();
 
// Returns true when the current time falls between the opening hours
$openingHour->IsOpenNow();