Recommend this page to a friend! |
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
Classes of Chun-Sheng, Li | > | PHP Work from Home Schedule | > | ![]() |
> | ![]() |
> | ![]() |
> | ![]() ![]() |
|
|
Groups | Applications | ![]() |
Groups |
![]() |
Classes using PHP 5 specific features | View top rated classes |
![]() |
Time and date values, formats and conversion | View top rated classes |
![]() |
Tools to assist project management | View top rated classes |
Innovation Award |
![]() March 2023 Nominee Vote |
Many developers have worked from home for years because they feel it is a more comfortable workplace. Still, many companies prefer that employees work from their offices. Since the pandemic, this preference has changed because many people have realized it is safer and faster to work from home, and employees can work more productively. This package provides a solution to suggest a schedule to define how two teams will alternate the work location between home and office space. Manuel Lemos |
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
![]() NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
![]() |
/ | src |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | tests | / | fixtures |
File | Role | Description |
---|---|---|
![]() ![]() |
Data | Auxiliary data |
![]() ![]() |
Data | Auxiliary data |
![]() ![]() |
Data | Auxiliary data |
![]() ![]() |
Data | Auxiliary data |
![]() NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|