A powerful and flexible Filament plugin for managing business hours in your application. Built on top of spatie/opening-hours, this plugin provides a complete solution for handling business hours with an elegant Filament interface.
HasBusinessHours
traitTake a look at what Filament Business Hours can do in this short feature-packed video!
Form Field
Form Field with Exceptions
Exceptions Modal
Table Column
Infolist Entry
This package use the following dependencies:
Before install the Business Hours Plugin, make sure the Table Repeater Filament plugin is configured according to the the docs: https://github.com/awcodes/filament-table-repeater?tab=readme-ov-file#installation
For more information about Spatie Opening Hours, please refer to the official Spatie Opening Hours documentation.
Filament Business Hours uses AnyStack to handle payment, licensing, and distribution. You can buy it here.
During the purchasing process, AnyStack will provide you with a license key. Once your license key is activated, you can proceed with the Composer installation described below.
Add the the Filament Business Hours package to repositories section of your composer.json
file:
{ "repositories": [ { "type": "composer", "url": "https://filament-business-hours.composer.sh" } ]}
Once the repository has been added to the composer.json
file, you can install like any other Composer package using the composer require
command:
composer require andreia/filament-business-hours:"^4.0"
Next, you will be prompted to provide your username and password.
Loading composer repositories with package informationAuthentication required (filament-business-hours.composer.sh):Username: [license-email]Password: [license-key]
Your username will be your email address and the password will be your license key. For example, let's say we have the following email and license activation:
Contact email: your@email.comLicense key: 04c21df8f-4890-7024-y2vk-6bny143ta642
You will need to enter the above information as follows when prompted for your credentials:
Loading composer repositories with package informationAuthentication required (filament-business-hours.composer.sh):Username: your@email.comPassword: 04c21df8f-4890-7024-y2vk-6bny143ta642
php artisan vendor:publish --tag="filament-business-hours-migrations"php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="filament-business-hours-config"
Optionally, you can publish the views using:
php artisan vendor:publish --tag="filament-business-hours-views"
The package comes with English translations out of the box. Publish the language files to customize:
php artisan vendor:publish --tag="filament-business-hours-translations"
Filament recommends developers create a custom theme to better support plugin's additional TailwindCSS classes. After you have created your custom theme, add the Business Hours vendor directory to your theme's theme.css
file usually located in resources/css/filament/admin/theme.css
:
/* ... */ @source '../../../../vendor/filament-handbook/filament-business-hours';
The HasBusinessHours
Trait provides the businessHours
relationship and convenient methods to quick build business/opening hours Spatie object.
Add the included HasBusinessHours
trait to the model (e.g., User
, Team
, Company
etc.) that you want to add business hours:
use Andreia\FilamentBusinessHours\Concerns\HasBusinessHours; class Business extends Model{ use HasBusinessHours;}
It gives you:
morphOne
relationship to BusinessHours
OpeningHours
as an instance$modelWithBusinessHours = Company::find($companyId); // Check if business is open$modelWithBusinessHours->isOpen(); // Get next opening time$nextOpen = $modelWithBusinessHours->nextOpen(); // Get current open range$range = $modelWithBusinessHours->currentOpenRange(); // Check specific date/time$isOpen = $modelWithBusinessHours->isOpen(now()->addDays(2));
You can also use all Spatie's Opening Hours methods available to query and format the set of business/opening hours.
use Andreia\FilamentBusinessHours\Forms\Components\BusinessHoursField; BusinessHoursField::make('businessHours') ->allowExceptions()
Any Form layout can be used to wrap the business hours, for example, using Section
:
use Andreia\FilamentBusinessHours\Forms\Components\BusinessHoursField; Forms\Components\Section::make('Business Hours') ->description('Control the availability of hours on each weekday') ->icon('heroicon-o-clock') ->schema([ BusinessHoursField::make('businessHours') ->allowExceptions(), ]),
Allow Exceptions
To allow the user provide exceptions to the business hours added, use the ->allowExceptions()
method. It will show the button to set up exceptions.
use Andreia\FilamentBusinessHours\Forms\Components\BusinessHoursField; $form->schema([ // ... BusinessHoursField::make('businessHours') ->allowExceptions(),]),
The exceptions can be added through a modal UI opened by the “Set up” button in the form.
The exceptions will be saved in Spatie-style on exceptions
database column:
'exceptions' => [ '2025-11-11' => ['09:00-12:00'], '2025-07-04' => [], // closed all day '01-01' => [], // recurring annually '12-25' => ['09:00-12:00'], // recurring annually '12-25 to 12-25' => [ 'hours' => [], 'data' => 'Holidays', ], '2025-06-25 to 2025-07-01' => [ 'hours' => [], 'data' => 'Closed for works', ],]
use Andreia\FilamentBusinessHours\Tables\Columns\BusinessHoursColumn; // businessHours is the name of the relationshipBusinessHoursColumn::make('businessHours')
use Andreia\FilamentBusinessHours\Infolists\Components\BusinessHoursEntry; // businessHours is the name of the relationshipBusinessHoursEntry::make('businessHours')
Any Infolist layout can be used to wrap the business hours, for example, using Section
:
use Andreia\FilamentBusinessHours\Infolists\Components\BusinessHoursEntry;use Filament\Infolists; Infolists\Components\Section::make('Business Hours') ->description('Control the availability of hours on each weekday') ->icon('heroicon-o-clock') ->schema([ BusinessHoursEntry::make('businessHours') ->hiddenLabel() ->columnSpanFull(), ]),
composer test
Please see CHANGELOG for more information on what has changed recently.
Users with active licenses may access the private repo to contribute by visiting the Licenses
tab of your AnyStack account.
If you have any questions, find a bug, need support, or have a feature request or suggestion, please don't hesitate to reach out to me at andreiabohner@gmail.com. I'd love to hear from you.
The Single Project license allows for the utilization of Filament Business Hours within a single project hosted on one domain or subdomain. It is suitable for personal websites or websites tailored to specific clients.
If you intend to incorporate Filament Business Hours into a SaaS application, you must obtain an Unlimited Projects or Lifetime license.
Under the Single Project license, you are authorized to activate Filament Business Hours up to 4 times (development, test, staging, and production).
You will receive updates and bug fixes for one year from the purchase date. If you choose not to renew your license, you can only install the plug-in up to the latest version available before the license expiration. Renewing the license at a discounted price allows you to continue receiving updates and new features.
The Unlimited Projects license permits the utilization of Filament Business Hours on unlimited domains, subdomains, and even in SaaS applications.
You will receive updates and bug fixes for one year from the purchase date. If you choose not to renew your license, you can only install the plug-in up to the latest version available before the license expiration. Renewing the license at a discounted price allows you to continue receiving updates and new features.
Please note that the licenses for Filament Business Hours does not allow the public distribution of its source code. Hence, you cannot build and distribute applications publicly using Filament Business Hours source code on open-source platforms.
If you're uncertain about which license is appropriate for your needs, don't hesitate to reach out. Contact me at andreiabohner@gmail.com, and I'll be glad to assist you.
Andréia is a full-stack web developer and an enthusiastic open-source contributor & maintainer. She loves coding, reading, and learning new things every day! You can learn more about Andréia on her GitHub profile.