Download the PHP package phpexperts/workday-planner without Composer

On this page you can find all versions of the php package phpexperts/workday-planner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package workday-planner

The PHP Workday Planner

Travis CI Maintainability Test Coverage

Installation

Run composer require phpexperts/workday-planner

The Problem

Imagine that you have to schedule a task to run every workday in your country over a given time period.

In order to do this, you first have to figure out what the workdays are, and the weekends. Simple enough, right? But then you remember: "Hey, what about Christmas? and all those other holidays?"

So you dutifully go about detecting those, too. Only to have your clients complaining on the Monday after the Fourth of July. Because, you see, at least in the United States, holidays that occur on Saturdays are observed on the previous Friday, while holidays that occur on Sundays are observed on the next Monday.

The Solution

With this package, all of these technicalities are handled for you. You give it a date range, and it will dutifully spit out the workdays, keeping in mind both the actual and observed U.S. national holidays common to most employers.

Ad-hoc Workday Verification

Floating Holidays

Some holidays are based upon a certain day of the month, instead of a fixed date. These are called "floating holidays".

The date spec looks like this for Thanksgiving Day:

Examples:

Observerable Holidays

Ad-hoc Holiday Verification

Access to the Workdays

There are several ways to access the workdays.

The Workday Planner can be accessed like an array, or as an iterator, or you can just get a simple array of all the workday dates.

Simple access

As an iterator

As an array

Manually remove a workday

Workdays can be manually removed, per your policies:

Behavior Documentation

The project currently has 100% code coverage via unit tests.

Here is the behavior documentation, generated by PHPUnit's testdox:

HolidayDetector

  1. Can parse fixed holiday dates
  2. Can parse floating holiday dates
  3. Can determine if a date is a holiday
  4. Shows error for unimplemented country
  5. Shows error for invalid data
  6. Shows error for invalid holiday spec
  7. Properly handles unknown holidays
  8. Will report friday as the observed day for saturday holidays
  9. Will report friday as the observed day for sunday holidays

WorkdayDetector

  1. Can determine if a date is a workday

WorkdayPlanner

  1. Will create a date range of workdays
  2. Will properly offset saturday holidays
  3. Will properly offset sunday holidays
  4. Can iterate through each date
  5. The number of workdays is countable
  6. Can access dates via the array operator with a numeric index
  7. Can access dates via the array operator with a date index
  8. Can use numeric isset on a workday
  9. Can use date isset on a workday
    1. Can remove a work day via unset
    2. Properly handles a start date later than the end date
    3. Properly handles a start date equal to the end date
    4. Properly handles invalid dates
    5. Wont allow manually adding workdays

Credits

Created by Theodore R. Smith [email protected], mostly in one day.

A PHP Experts, Inc., project.


All versions of workday-planner with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpexperts/workday-planner contains the following files

Loading the files please wait ....