Skip to content

krzystof/business-calendar

Repository files navigation

business-calendar

Latest Unstable Version Build Status StyleCI Total Downloads

Manage a business calendar with a working week, openings and events.

THIS IS NOT A STABLE PACKAGE AND SHOULD NOT BE USED IN PRODUCTION

API

Calendar

In progress

Working Week

$workingWeek->addOpening(new Opening([
    'day' => Carbon::MONDAY, 'time' => '06:00', 'length' => 12 * 3600
]));
$workingWeek->addOpening($opening2);

$workingWeek->countOpenings();           // returns the count of the openings
$workingWeek->isOpenAt(Carbon::now());   // returns bool
$workingWeek->workingHours();            // returns the sum of the working hours of the openings

Opening

$opening->opensAt();  // Return a Carbon instance
$opening->closesAt(); // Return a Carbon instance

// Check wether the two Openings overlaps:
$opening1->overlaps($opening2); // returns bool
// Merge them:
$opening1->merge($opening2);

// Get the day value to instantiate an opening
Opening::dayOfWeek('monday') // returns 1

Events

In progress

Task

In progress

BusinessTime

A couple of helpers to work with time and dates.

BusinessTime::dayFromString('Friday');  // returns 5
BusinessTime::dayToString(0);           // returns 'Sunday'
BusinessTime::hoursToSeconds(2);        // returns 7200
BusinessTime::secondsToHours(3600)      // returns 1

About

📆 Manage a business calendar with working hours and events

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages