Download the PHP package letsjump/workday-helper-php without Composer

On this page you can find all versions of the php package letsjump/workday-helper-php. 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-helper-php

Packagist Downloads Packagist License Packagist Version GitHub issues Packagist PHP Version Support Scrutinizer code quality (GitHub/Bitbucket)

WorkdayHelper

Count workdays and list holiday events in a range of dates with PHP taking care of public holidays and other custom closing days.

Inspired by Massimo Simonini getWorkdays() Gist. @see https://gist.github.com/massiws/9593008

Benefits and features:

Requirements

PHP 5.6.0 and later

Composer

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Manual Installation

If you do not wish to use Composer, you can download the latest release.

Dependencies

PHP ext-calendar

To automatically calculate Easter dates, you have to compile PHP with --enable-calendar. See ext-calendar. You can refer to this Stack Overflow question if you are in a Docker environment.

If your PHP isn't compiled with ext-calendar and if you cannot compile it, please set $calculateEaster to false otherwhise WorkingdayHelper will throw an exception.

Usage:

  1. Count the days worked in January while working from Monday to Friday, taking care of public holidays:

  2. count the day worked in april while working Monday, Wednesday and Friday, taking care of public holidays:

  3. Add a strike to the custom closing days

  4. Get the calendar with all the closing days for a specific date interval

Add custom closings

Custom closure is an array of events. Each event is an array with this configuration:

key value mandatory
date date in Y-m-d format yes
event a string representing the name of the closing yes
options a string or an array passed as is to the holiday calendar. It may contain information such as event_id, user_id, html attributes, etc.. Please remember that data are passed as they are so, to prevent malicious injection attacks, consider the use of a string purifier function no

example

Replace the default recursive holiday calendar

The default recursive holiday calendar is an array of events. Each event is an array with this configuration:

key value mandatory
m-d the date must be in m-d format yes
event a string representing the name of the holiday yes
options a string or an array passed as is to the holiday calendar. It may contain information such as event_id, user_id, html attributes, etc.. Please remember that data are passed as they are so, to prevent malicious injection attacks, consider the use of a string purifier function no

example

Holiday calendar

The holiday calendar returns a list of holidays for the working days in the given date range. So if you want to retrive all the closing days in that date range you should set all the days of the week into the $workingDays Array E.G. $myWorkDay->workingDays[0,1,2,3,4,5,6].

The output is an array of events. Each array has the unix timestamp of the holiday as key and contains:

key value
unixTimestamp the unix timestamp of the event
date the readable date of the event (you can format it with the parameter $outputFormat
event the name of the event type public or custom depending if it is a publicHoliday or a customClosing.
options a string or an array of user custom options

Example

Side notes

The recursive holiday and the default date format are localized for Italy. I know it's not the right way to work, but I need to quickly develop an application for a customer. If you want to use your localization, please refer to Replace the default recursive holiday calendar. If you plan to use intensively in your application, you may extend the base class and configure there the basic properties.

Please report any bug or whishes into the apposite issue tracker


All versions of workday-helper-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
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 letsjump/workday-helper-php contains the following files

Loading the files please wait ....