krzystof / business-calendar
Manage working hours and events in a business calendar
v0.3.1
2017-04-19 20:02 UTC
Requires
- php: >=5.4
- nesbot/carbon: ~1.14
Requires (Dev)
- phpspec/phpspec: ^2.4
This package is not auto-updated.
Last update: 2024-11-09 18:54:11 UTC
README
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