honortaker / laravel-holidays-de
Import german holidays into your laravel application
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/honortaker/laravel-holidays-de
Requires
- php: ^8.2
- laravel/framework: ^11
Requires (Dev)
- laravel/pint: ^1.20
- orchestra/testbench: ^9.9
- phpunit/phpunit: ^11.5
README
This package provides tools to import german holidays into your laravel application using api-feiertage.de API.
Getting Started
- Run
composer require honortaker/laravel-holidays-deto install the package - Run
php artisan migrateto apply the database scheme - Run
php artisan holidays:importto import holidays into the database - Query holidays for your needs by using
Holiday::query()
Database Scheme
To get started using german holidays in your application, you need to run the artisan migrate command.
This package delivers a builtin migration that creates a table which will carry the information about the holidays.
The package allows you to set an alternative database table name for the model by changing values in the configuration file.
Import Holidays
After migrating your database, you can go ahead adn import the holiday information from the api using the HolidaysImportCommand:
php artisan holidays:import
By running the command, the holidays for the current year will be imported into the database.
Optionally you can pass in a specific year into the command:
php artisan holidays:import 2025
Query Holidays
When you filled your database using the artisan command above, you are ready to query the data for your needs by using the Holiday model:
use Honortaker\LaravelHolidaysDe\Models\Holiday; $holidays = Holiday::all();
Configuration
The package delivers a builtin configuration file which can also be published to overwrite values:
php artisan vendor:publish --tag="holiday-config"
Configuration: holidays-de.holidays_table_name
To prevent collisions with your application tables, you can decide how the table storing the holiday information should be named.
By default, it is named holidays.
Configuration: holidays-de.api_url
The url of the API is also configurable. This config should not be changed because the package expects the response data to be in a specific scheme. However, if the API will move to another domain or change the url in another way, the sourcecode does not need to be touched.
By default, it is set to https://get.api-feiertage.de.