PHP code example of germania-kg / opening-hours

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

    

germania-kg / opening-hours example snippets


interface Germania\OpeningTimes\OpeningTimesInterface

// Textual description regarding the opening times
public function getDescription() : ?string;
public function setDescription( string $text = null);

// Set information for certain days
public function getDay( string $day ) : ?string;
public function setDay( string $day, string $times = null );

// Common day interceptors, getter and setter
public function getMonday()    : ?string;
public function getTuesday()   : ?string;
public function getWednesday() : ?string;
public function getThursday()  : ?string;
public function getFriday()    : ?string;
public function getSaturday()  : ?string;
public function getSunday()    : ?string;  

use Germania\OpeningTimes\OpeningTimes;

$open = new OpeningTimes;

$open->setDescription("nach Vereinbarung");
$open->getDescription(); // "nach Vereinbarung"

$open->setDay("monday", "09 to 18");
$open->getDay("monday"); // "09 to 18"

$open->getMonday(); // null
echo $open->setMonday("whole day")->getMonday(); // "whole day"

// and also these Setters:
// - setMonday()
// - setTuesday()
// - setWednesday()
// - setThursday()
// - setFriday()
// - setSaturday()
// - setSunday()