| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 64 | All time: 10,420 This week: 78 | ||||
| Version | License | PHP version | Categories | |||
| work-home-schedule 1.0 | MIT/X Consortium ... | 5 | PHP 5, Time and Date, Project Management |
curl -sS https://getcomposer.org/installer | php
php composer.phar require lee/work-home-schedule:^1
This is about working home schedule to estimate current working status on specific date.
It's based on following scenario for A/B team work:
This situation will skip on country holiday and weekend.
This class depends on Carbon::mixin method.
The code snippets are as follows:
We assume that the 2020-04-06 is start date and working statuses are as follows:
Get next working date about code snippets are as follows:
require __DIR__ . '/vendor/autoload.php';
use Carbon\Carbon;
use Lee\WorkHomeSchedule;
$filePath = __DIR__ . '/tests/fixtures/2020_calendar.csv';
$workingHomeSchedule = new WorkHomeSchedule();
$workingHomeSchedule->startDateStatus = 'office'; // The default value is empty string
$workingHomeSchedule->csvPath = $filePath; // The default value is empty string
$workingHomeSchedule->csvHead = true; // The default value is true
$workingHomeSchedule = $workingHomeSchedule->loadCalendarData($filePath);
Carbon::mixin($this->workingHomeSchedule);
$currentDate = Carbon::create('2020-04-06');
$nextWorkingDate = $currentDate->nextWorkingDate();
$carbonDate = $nextWorkingDate['date']; // Carbon::class instance
$carbonDateString = (string)$nextWorkingDate['date']; // 2020-04-07 00:00:00
$workingStatus = $nextWorkingDate['status']; // home
Get previous working date about code snippets are as follows:
require __DIR__ . '/vendor/autoload.php';
use Carbon\Carbon;
use Lee\WorkHomeSchedule;
$filePath = __DIR__ . '/tests/fixtures/2020_calendar.csv';
$workingHomeSchedule = new WorkHomeSchedule();
$workingHomeSchedule->startDateStatus = 'office'; // The default value is empty string
$workingHomeSchedule->csvPath = $filePath; // The default value is empty string
$workingHomeSchedule->csvHead = true; // The default value is true
$workingHomeSchedule = $workingHomeSchedule->loadCalendarData($filePath);
Carbon::mixin($this->workingHomeSchedule);
$currentDate = Carbon::create('2020-04-06');
$previousWorkingDate = $currentDate->previousWorkingDate();
$carbonDate = $previousWorkingDate['date']; // Carbon::class instance
$carbonDateString = (string)$previousWorkingDate['date']; // 2020-04-01 00:00:00
$workingStatus = $previousWorkingDate['status']; // home
Get next working dates with specific date ranges about code snippets are as follows:
require __DIR__ . '/vendor/autoload.php';
use Carbon\Carbon;
use Lee\WorkHomeSchedule;
$filePath = __DIR__ . '/tests/fixtures/2020_calendar.csv';
$workingHomeSchedule = new WorkHomeSchedule();
$workingHomeSchedule->startDateStatus = 'office'; // The default value is empty string
$workingHomeSchedule->csvPath = $filePath; // The default value is empty string
$workingHomeSchedule->csvHead = true; // The default value is true
$workingHomeSchedule->workingDays = 2; // The default value is 1
$workingHomeSchedule = $workingHomeSchedule->loadCalendarData($filePath);
Carbon::mixin($this->workingHomeSchedule);
$currentDate = Carbon::create('2020-04-06');
$nextWorkingDates = $currentDate->nextWorkingDates(); // The array length is 2
$nextWorkingDates[0]['date'] // Carbon::class instance
(string)$nextWorkingDates[0]['date'] // 2020-04-07 00:00:00
$nextWorkingDates[0]['status'] // home
$nextWorkingDates[1]['date'] // Carbon::class instance
(string)$nextWorkingDates[1]['date'] // 2020-04-08 00:00:00
$nextWorkingDates[1]['status'] // office
Get previous working dates with date ranges about code snippets are as follows:
require __DIR__ . '/vendor/autoload.php';
use Carbon\Carbon;
use Lee\WorkHomeSchedule;
$filePath = __DIR__ . '/tests/fixtures/2020_calendar.csv';
$workingHomeSchedule = new WorkHomeSchedule();
$workingHomeSchedule->startDateStatus = 'office'; // The default value is empty string
$workingHomeSchedule->csvPath = $filePath; // The default value is empty string
$workingHomeSchedule->csvHead = true; // The default value is true
$workingHomeSchedule->workingDays = 2; // The default value is 1
$workingHomeSchedule = $workingHomeSchedule->loadCalendarData($filePath);
Carbon::mixin($this->workingHomeSchedule);
$currentDate = Carbon::create('2020-04-06');
$previousWorkingDates = $currentDate->previousWorkingDates(); // array length is 2
$previousWorkingDates[0]['date'] // Carbon::class instance
(string)$previousWorkingDates[0]['date'] // 2020-04-01 00:00:00
$previousWorkingDates[0]['status'] // home
$previousWorkingDates[1]['date'] // Carbon::class instance
(string)$previousWorkingDates[1]['date'] // 2020-03-31 00:00:00
$previousWorkingDates[1]['status'] // office
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Doc. | Documentation | |||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.