Download the PHP package honortaker/laravel-holidays-de without Composer
On this page you can find all versions of the php package honortaker/laravel-holidays-de. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download honortaker/laravel-holidays-de
More information about honortaker/laravel-holidays-de
Files in honortaker/laravel-holidays-de
Package laravel-holidays-de
Short Description Import german holidays into your laravel application
License MIT
Informations about the package laravel-holidays-de
honortaker/laravel-holidays-de
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-de
to install [the package]() - Run
php artisan migrate
to apply the database scheme - Run
php artisan holidays:import
to 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
:
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:
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:
Configuration
The package delivers a builtin configuration file which can also be published to overwrite values:
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
.