Download the PHP package codemonauts/craft-holidays without Composer

On this page you can find all versions of the php package codemonauts/craft-holidays. 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 craft-holidays

International holidays plugin for Craft CMS

A plugin for Craft CMS that provides access to many international holidays.

This plugin is based on the awesome work of yasumi. Go and buy him a coffee!

Background

This plugin provides easy access to holidays in many countries. For example to automatically determine if a shop or restaurant is open or closed on an official holiday in a country.

Coverage

Currently 35 countries and 85 sub-regions:

Australia, Austria, Belgium, Bosnia & Herzegovina, Brazil, Croatia, Czechia, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Ireland, Italy, Japan, Latvia, Lithuania, Netherlands, New Zealand, Norway, Poland, Portugal, Romania, Russia, Slovakia, South Africa, South Korea, Spain, Sweden, Switzerland, United States, Ukraine and United Kingdom

For more details see yasumi's feature page. And if you are missing your country, why not contribute by adding a new provider for your country?

Requirements

Installation

Open your terminal and go to your Craft project:

Switch to the settings page in the control panel and enter select your default country and subregion.

Usage

You can query for holidays like for entries:

or same in php:

Filtering

You can combine the following filters in any order:

type(typename) specifies the type of holidays to return. Default is Null. Possible other types are:

country(code) sets the country for which the holidays should be returned. The code is the ISO 3166-2 code of the country and its subregion. You can set the default country in the settings.

locale(code) sets the locale code to translate the holidays names to. The default is set to your site locale in Craft CMS.

year(year) specifies for which year the holidays are returned. You can only get the holidays for one specific year. This is set automatically to the date set by on() or between(). Normally you do not need to specify anything here.

on(date) sets a single date to check for holidays. You can provide a DateTimeInterface or a date string like '2019-12-25' or a string that can be parsed by strtotime.

between(startDate, endDate) filter for a time range. Same rules as for on(date).

Fetching

To fetch the results you have different functions:

one() returns the first holiday as an extended DateTime object (see results).

all() returns all holidays as array (actually an iterator) of extended DateTime objects.

count() returns the number of holidays found.

isHoliday() returns true or false if a holiday exists.

Results

As result you get a DateTime object with the following extensions:

getType() returns the type of holiday.

getName() returns the translated name of the holiday. If for the given locale no translation is defined, the name in 'en_US' is returned.

Examples

Get all holidays of a year:

Get all official holidays of a time range:

Check if today is a official holiday in Japan:

Settings

You can set the default country and subregion in a config file placed in your CraftCMS config directory. You can find the most recent version in src/config.php. You have to name the file holidays.php.

If you do not set a default country code or the country code could not be found, we fall back to US.

With ❤ by codemonauts


All versions of craft-holidays with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^4.0.0
azuyalabs/yasumi Version ^2.5.0
ext-json Version *
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 codemonauts/craft-holidays contains the following files

Loading the files please wait ....