PHP code example of applicazza / appointed

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

    

applicazza / appointed example snippets


date_default_timezone_set('Asia/Jerusalem');

use Applicazza\Appointed\BusinessDay;

// ...
$business_day = new BusinessDay;

use Applicazza\Appointed\Period;

// ...

$period_0900_1400 = Period::make(today( 9, 00), today(14, 00));
$period_1600_1900 = Period::make(today(16, 00), today(19, 00));

$business_day->addOperatingPeriods(
    $period_1600_1900,
    $period_0900_1400
);

use Applicazza\Appointed\Appointment;

// ...

$appointment_1100_1130 = Appointment::make(today( 11, 00), today(11, 30));
$appointment_1200_1330 = Appointment::make(today( 12, 00), today(13, 30));

$business_day->addAppointments(
    $appointment_1100_1130,
    $appointment_1200_1330
);

$business_day->fit($appointment_1300_1330, 'backward');
$business_day->fit($appointment_1300_1330);

$business_day->deleteAppointments($appointment_1300_1330);

$business_day->deleteOperatingPeriod($period_0900_1400)

$business_day->editOperatingPeriod($period_1330_1400, $period_1330_1430)

$agenda = $business_day->getAgenda();
// To pretty print results
echo json_encode($business_day->getAgenda(), JSON_PRETTY_PRINT), PHP_EOL;

use function Applicazza\Appointed\interval;
use function Applicazza\Appointed\today;
// ...
interval($hours = 0, $minutes = 0, $seconds = 0);
today($hours = 0, $minutes = 0, $seconds = 0);