PHPackages                             reinbier/laravel-holiday - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. reinbier/laravel-holiday

ActiveLibrary

reinbier/laravel-holiday
========================

Holidays in Laravel, the right way.

v3.0.0(4mo ago)22.1k↓21.9%4[3 PRs](https://github.com/Reinbier/laravel-holiday/pulls)MITPHPPHP ^8.2CI passing

Since Feb 16Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Reinbier/laravel-holiday)[ Packagist](https://packagist.org/packages/reinbier/laravel-holiday)[ Docs](https://github.com/reinbier/laravel-holiday)[ RSS](/packages/reinbier-laravel-holiday/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (20)Used By (0)

Custom holidays in Laravel
==========================

[](#custom-holidays-in-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4433614694059a36e6e3eaed6f6c382a7dd70728fa757a2a4fd454b5bac16548/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7265696e626965722f6c61726176656c2d686f6c696461792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/reinbier/laravel-holiday)[![GitHub Tests Action Status](https://camo.githubusercontent.com/80050d7e091450de2848da33a0b8bb8e65ccd9ee260993c9db3af2eb239fb116/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7265696e626965722f6c61726176656c2d686f6c696461792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/reinbier/laravel-holiday/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/33e53e7692e616d256d20966290945992f6b0223de81faa61140a53b9ebbdfe4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7265696e626965722f6c61726176656c2d686f6c696461792f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/reinbier/laravel-holiday/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5b6e57c0e83bf58c3d610eaa162ba47dbe3e27918d811c8ac8c2f9563c0cecf1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7265696e626965722f6c61726176656c2d686f6c696461792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/reinbier/laravel-holiday)

This package helps by providing a Holiday model in your project with all the holidays for a specific year.

By storing them in the database and automatically injected into Carbon via the [BusinessDay](https://github.com/kylekatarnls/business-day)package, you can simply see if a given Carbon instance represents a holiday, via `$carbon->isHoliday()`.

The benefits of the model are that you can easily add your own holidays. On top of that, the package can generate holidays for the current locale.

Use cases
---------

[](#use-cases)

An example would be when you want to show your store's opening hours. When echoing your opening hours for each day, you can check whether the given date is a holiday and say that you're closed this day.

### Versioning

[](#versioning)

For the sake of maintainability and testability, this package uses different major versions to support Laravel, make sure to pick the right one based on the table below.

Laravel versionPackage versionv9 &amp; 10v2.xv11 &amp; 12v3.xInstallation
------------

[](#installation)

You can install the package via composer:

```
composer require reinbier/laravel-holiday
```

You should publish and run the migrations:

```
php artisan vendor:publish --tag="holiday-migrations"
php artisan migrate
```

Optionally, you can publish the config file with:

```
php artisan vendor:publish --tag="holiday-config"
```

This is the contents of the published config file:

```
return [

    /**
     * The name of the table to use. You can adjust this to suit your needs.
     */
    'table_name' => 'holidays',

    /**
     * If you want to use a different locale to generate holidays for,
     * you can set it here. For now, a sensible default is set.
     */
    'locale' => config('app.locale', 'nl'),

    /**
     * When true, sets the holidays for Carbon in the service container.
     */
    'enable_carbon' => false,

];
```

Usage
-----

[](#usage)

To generate local holidays for the current and next year, execute the command.

```
php artisan holiday:generate
```

Subsequently, you could schedule this command to run yearly so your table will always hold data when working with the Holiday model.

To do that, place the following line into your Console/Kernel.php 'schedule' method:

```
    protected function schedule(Schedule $schedule)
    {
        // ...

        $schedule->command('holiday:generate')->yearly();
    }
```

### Using the Facade

[](#using-the-facade)

The `LaravelHoliday` Facade gets automatically registered in the service container. The facade is a singleton and will hold the current year's Holiday model. It will set global holidays throughout your application so that you can check any date for whether it's treated as a holiday according to your model.

The facade also provides you with a couple of methods:

```
use Reinbier\LaravelHoliday\Facades\LaravelHoliday;

// The Holiday model of the current year
$holiday = LaravelHoliday::model();

// All holiday-dates in a Collection
$holidays = LaravelHoliday::getHolidays();

// Set the Holiday model and chain methods
LaravelHoliday::forYear(2023)
    ->addHoliday('2023-06-07', 'boss-birthday')
    ->getHolidays();

// Simply add multiple holidays by chaining
LaravelHoliday::forYear(2023)
    ->addHoliday('2023-06-07', 'boss-birthday')
    ->addHoliday('2023-10-10', 'anniversary')
    -> ...
```

### Future holidays

[](#future-holidays)

If you don't want to be limited to only the current year's holidays, you can fetch all future holidays as well using the helper method on the facade: `getFutureHolidays()`.

```
use Reinbier\LaravelHoliday\Facades\LaravelHoliday;

$future_holidays = LaravelHoliday::getFutureHolidays();
// You may optionally specify a year, until when to retrieve holidays
$future_holidays = LaravelHoliday::getFutureHolidays(2035);
```

### Enable holidays in Carbon

[](#enable-holidays-in-carbon)

The package can automatically apply your stored holidays to Carbon instances, so that, whenever you need to check a date to be a holiday, you can call `->isHoliday()` on that Carbon instance.

This setting is disabled by default. To enable this, set the value in the config `holiday.php`.

```
'enable_carbon' => true,
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [reinbier](https://github.com/Reinbier)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance83

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 58.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~65 days

Recently: every ~208 days

Total

17

Last Release

143d ago

Major Versions

v0.1.1 → v1.0.02023-02-17

v1.2.0 → v2.0.02023-03-01

v2.2.0 → v3.0.02025-12-26

PHP version history (2 changes)v0.1.0PHP ^8.1

v3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/312abbf8efd2ed8be5230a106e6284455fe65f200e20f05d48c9b872ecb215ca?d=identicon)[reinbier](/maintainers/reinbier)

---

Top Contributors

[![Reinbier](https://avatars.githubusercontent.com/u/7080398?v=4)](https://github.com/Reinbier "Reinbier (51 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (15 commits)")

---

Tags

holidayslaravelphplaravelReinbierlaravel-holiday

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/reinbier-laravel-holiday/health.svg)

```
[![Health](https://phpackages.com/badges/reinbier-laravel-holiday/health.svg)](https://phpackages.com/packages/reinbier-laravel-holiday)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
