Download the PHP package intragile/laravel-hungarian-workdays without Composer

On this page you can find all versions of the php package intragile/laravel-hungarian-workdays. 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 laravel-hungarian-workdays

Laravel Hungarian Workdays

Developed and maintained by IntrAgile Kft.

Tests Latest Version PHP

The Hungarian workday calendar: statutory public holidays (munkaszüneti napok), the bridge days and working Saturdays decreed each year (áthelyezett munkanapok, ledolgozós szombatok), workday arithmetic, Carbon macros and a validation rule.

Magyar nyelvű leírás → README.hu.md

What counts as a workday

"Workday" means a working day under the general work schedule (általános munkarend): Monday to Friday, except public holidays and the rest days moved by the yearly decree, plus the Saturdays worked in exchange. Workplaces with a different schedule (shift work, retail) are out of scope.

Only the statutory holidays of Mt. 102. § (1) are listed. Easter Sunday and Whit Sunday are not, as they are Sundays anyway.

24 December becomes a public holiday from 2026. Parliament adopted the amendment on 2026-11-03 (bill T/714); its promulgation in the Magyar Közlöny is pending as of 2026-11-05. The bundled 2026 data already reflects it: the decree's 2026-12-24 rest day and 2026-12-12 worked Saturday pair is removed, and 2026-12-24 is a public holiday. If the promulgation fails or changes, this will be revisited, see DATA-SOURCES.md.

Requirements

Installation

The service provider and the Workdays facade are discovered automatically. To publish the configuration or the validation messages:

Core usage (any PHP project)

The core has no dependencies:

Method Returns
dayType($date) a DayType: Workday, Weekend, PublicHoliday, RestDay (moved rest day), TransferredWorkday (worked Saturday)
isWorkday($date) true for Workday and TransferredWorkday
isPublicHoliday($date), holiday($date) the statutory holiday check and the Holiday case (or null)
holidays($year) the year's holidays, keyed by Y-m-d
nextWorkday($date, inclusive: false), previousWorkday(...) the first workday after (before) the day; inclusive: true accepts the day itself
addWorkdays($date, $n), subWorkdays($date, $n) moves by $n workdays; 0 returns the day itself at 00:00
workdaysBetween($from, $to) workdays from $from to $to, both included
workdaysInMonth($year, $month), workingHoursInMonth($year, $month, $dailyHours = 8) the month's workdays and hours
isCovered($year), coveredYears() schedule coverage, see below

Holiday also offers hungarianName() and englishName().

Holiday::dateIn($year) returns midnight UTC, whereas Calendar results keep the input's timezone. Compare dates by format('Y-m-d'), not with == on the objects. Holiday::forYear() and dateIn() are range-lenient helpers: for a year before 2013 they return [] or null, which means "outside the supported range", not "not a holiday". Use the Calendar methods for answers that are range-checked.

Coverage and UncoveredYearException

The package bundles the schedules of 2013–2026. 2017 and 2023 had no transfer decree; both are bundled as covered, with no moved days.

Asking about a year without a schedule throws UncoveredYearException (its year property carries the year), because a bridge day could otherwise be missed without notice. Years before 2013 are never supported: every Calendar query about them throws, holiday(), isPublicHoliday() and holidays() included, and the exception message says the year is outside the supported range. Calendar arithmetic that walks into an uncovered year throws as well.

The holiday rules need no schedule, so those three methods answer for any year from 2013 on, covered or not.

2027 is not covered yet. The 2027 decree was due by 2026-10-31 but had not been published when this was written (2026-11-05). Until it is, any 2027 date throws. The Artisan command and the CI job described below warn you while it is missing.

Adding a year yourself

In Laravel, add the year to the configuration (config/workdays.php). Take the dates from the decree published in the Magyar Közlöny; the lists below are empty placeholders, not real data:

In plain PHP:

A configured (or with()) year replaces a bundled one of the same year. Schedule::fromArray() validates the data and throws InvalidScheduleException for a year before 2013, a malformed date, a date outside the decree year and the year before it, a worked day that is not a Saturday, a rest day on a weekend, or a date that is already a public holiday. The Laravel configuration is checked the same way, and its keys must be years.

assumingNoTransfers()

As a stopgap you can tell the calendar to treat an uncovered year as having no moved rest days and no worked Saturdays:

In Laravel, set 'assume_no_transfers' => true in config/workdays.php. Dates that loaded schedules list still apply, and the statutory holidays always do.

The risk: Hungarian decrees regularly move a day for several bridge days a year. Under this assumption such a rest day is reported as a workday, and the Saturday worked in exchange as a weekend. Use it only until the decree is published, and not for payroll, deadlines or anything legally binding. Years before 2013 still throw.

Laravel

Facade

The facade proxies the Calendar, which is also resolvable from the container.

Carbon macros

Registered on Carbon and CarbonImmutable:

Date-returning macros give an instance of the receiver's own class at 00:00 in its timezone and never modify the receiver.

The Calendar is a container singleton, built on first use from the configuration at that moment. The macros look it up in the container captured at boot on every call, so they share that instance. In long-lived workers such as Octane or queue workers, a change to workdays.schedules or workdays.assume_no_transfers made after the first use therefore needs a worker restart.

Validation

The value must be a DateTimeInterface or a string PHP can parse as a date. Three failure messages exist, in English and Hungarian: not a date, not a working day, and no schedule available for the year (the rule fails instead of throwing).

Customising the message depends on how you use the rule:

To customise the three messages separately for both forms, publish the workdays-lang files and edit the hungarian-workdays::validation entries.

Artisan command

Prints the covered years (for example Covered years: 2013–2026). It exits with a failure and a warning whenever the current year is not covered, and from 31 October on also when the schedule for the next year is missing, so a scheduler or a deployment check can raise the alarm.

Data sources

All data comes from primary legal sources (the Nemzeti Jogszabálytár and the Magyar Közlöny); third-party calendar sites are never used. Decree titles, URLs and the open points (the pending 24 December promulgation, the 2027 decree) are in DATA-SOURCES.md. Legislation is not subject to copyright in Hungary.

bin/check-coverage.php fails when the current year is not bundled, and from 31 October when next year is not. The repository's separate schedule-coverage workflow runs it weekly, so a missing decree surfaces without anyone having to remember, and without turning the tests badge red.

Related packages

Testing

Security

See SECURITY.md.

License

MIT, see LICENSE.


Developed and maintained by IntrAgile Kft..


All versions of laravel-hungarian-workdays with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 intragile/laravel-hungarian-workdays contains the following files

Loading the files please wait ...