PHPackages                             karaodin/filament-opening-hours - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. karaodin/filament-opening-hours

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

karaodin/filament-opening-hours
===============================

A Filament plugin for managing business opening hours with timezone support and exceptions

v2.2.1(9mo ago)5631[1 issues](https://github.com/karaOdin/filament-opening-hours/issues)MITPHPPHP ^8.1|^8.2|^8.3|^8.4

Since Jul 20Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/karaOdin/filament-opening-hours)[ Packagist](https://packagist.org/packages/karaodin/filament-opening-hours)[ Docs](https://github.com/karaOdin/filament-opening-hours)[ RSS](/packages/karaodin-filament-opening-hours/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (15)Used By (0)

Filament Opening Hours
======================

[](#filament-opening-hours)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f2271eaad1e2f305f3d78e245d4a77e8f565a126afdf4a8ebd469afeecddeeea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6172616f64696e2f66696c616d656e742d6f70656e696e672d686f7572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/karaodin/filament-opening-hours)[![Total Downloads](https://camo.githubusercontent.com/cbbd37000ebcdc2500a24002e13131261f82ee5027aa4c927feeced23cefb842/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6172616f64696e2f66696c616d656e742d6f70656e696e672d686f7572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/karaodin/filament-opening-hours)

A **premium-quality** Filament plugin for managing business opening hours with advanced timezone support, visual interfaces, and comprehensive exception management. Built on top of [spatie/opening-hours](https://github.com/spatie/opening-hours).

✨ Features
----------

[](#-features)

- 🕐 **Advanced Visual Form Builder** - Intuitive interface with collapsible sections and live validation
- 🌍 **Comprehensive Timezone Support** - Searchable timezone dropdown with Algeria as default
- 📅 **Smart Exception Management** - Modal-based system with date ranges and recurring exceptions
- 🎯 **Multiple Display Modes** - Circular charts, status badges, and detailed weekly views
- 🔄 **Global Enable/Disable** - Master toggle for entire business hours system
- 📊 **Rich Table Columns** - Interactive circular displays with hover tooltips
- 📋 **Enhanced Infolist Entries** - Beautiful formatted displays with animations
- 🎨 **Premium Styling** - Professional gradients, animations, and dark mode support
- ⚡ **Performance Optimized** - Lazy loading assets and efficient queries
- 📱 **Mobile Responsive** - Optimized for all screen sizes

🚀 Installation
--------------

[](#-installation)

You can install the package via composer:

```
composer require karaodin/filament-opening-hours
```

You can publish the config file with:

```
php artisan vendor:publish --tag="filament-opening-hours-config"
```

💻 Usage
-------

[](#-usage)

### 1. Add the Plugin to Your Panel

[](#1-add-the-plugin-to-your-panel)

```
use KaraOdin\FilamentOpeningHours\OpeningHoursPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(new OpeningHoursPlugin());
}
```

### 2. Prepare Your Model

[](#2-prepare-your-model)

Add the trait to your model and ensure you have the required database columns:

```
use KaraOdin\FilamentOpeningHours\Concerns\HasOpeningHours;

class Restaurant extends Model
{
    use HasOpeningHours;

    protected $casts = [
        'opening_hours' => 'array',
        'opening_hours_exceptions' => 'array',
    ];
}
```

**Migration example:**

```
Schema::table('restaurants', function (Blueprint $table) {
    $table->json('opening_hours')->nullable();
    $table->json('opening_hours_exceptions')->nullable();
    $table->string('timezone')->default('Africa/Algiers');
    $table->boolean('opening_hours_enabled')->default(true);
});
```

### 3. Use in Forms

[](#3-use-in-forms)

```
use KaraOdin\FilamentOpeningHours\Components\OpeningHoursForm;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            // ... other fields

            ...OpeningHoursForm::schema(),
        ]);
}
```

### 4. Display in Tables

[](#4-display-in-tables)

```
use KaraOdin\FilamentOpeningHours\Components\OpeningHoursColumn;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            // ... other columns

            // Option 1: Circular visual display (recommended)
            OpeningHoursColumn::make('opening_hours')
                ->label('Hours')
                ->circular()
                ->showTooltips(),

            // Option 2: Status badge
            OpeningHoursColumn::make('status')
                ->label('Status')
                ->status(),

            // Option 3: Weekly overview
            OpeningHoursColumn::make('schedule')
                ->label('Schedule')
                ->weekly(),
        ]);
}
```

### 5. Display in Infolists

[](#5-display-in-infolists)

```
use KaraOdin\FilamentOpeningHours\Components\OpeningHoursEntry;

public static function infolist(Infolist $infolist): Infolist
{
    return $infolist
        ->schema([
            // ... other entries

            // Option 1: Full details (recommended)
            OpeningHoursEntry::make('opening_hours')
                ->label('Business Hours')
                ->full(),

            // Option 2: Status only
            OpeningHoursEntry::make('status')
                ->label('Current Status')
                ->statusOnly(),

            // Option 3: Weekly hours only
            OpeningHoursEntry::make('hours')
                ->label('Weekly Schedule')
                ->weeklyHours(),

            // Option 4: Compact summary
            OpeningHoursEntry::make('summary')
                ->label('Hours Summary')
                ->compact(),
        ]);
}
```

🎯 Model Methods
---------------

[](#-model-methods)

The `HasOpeningHours` trait provides powerful query methods:

```
$restaurant = Restaurant::first();

// Check if currently open
$restaurant->isOpen(); // true/false
$restaurant->isClosed(); // true/false

// Check specific times
$restaurant->isOpen(Carbon::parse('2024-01-15 14:30')); // true/false

// Check specific days
$restaurant->isOpenOn('monday'); // true/false
$restaurant->isClosedOn('sunday'); // true/false

// Get next opening/closing times
$restaurant->nextOpen(); // Carbon instance or null
$restaurant->nextClose(); // Carbon instance or null

// Get current status with human readable format
$restaurant->getCurrentStatus(); // "Open until 17:00" or "Closed until 09:00"

// Get hours for specific day/date
$restaurant->getOpeningHoursForDay('monday'); // ['09:00-17:00']
$restaurant->getOpeningHoursForDate(Carbon::today()); // ['09:00-17:00']

// Exception management
$restaurant->addException('2024-12-25', []); // Closed on Christmas
$restaurant->addException('2024-12-31', ['09:00-15:00']); // Special hours
$restaurant->removeException('2024-12-25');
$restaurant->hasException('2024-12-25'); // true/false
```

⚙️ Configuration
----------------

[](#️-configuration)

The config file allows you to customize:

```
return [
    // Default timezone
    'default_timezone' => 'Africa/Algiers',

    // Time format for display
    'time_format' => 'H:i',

    // Days of the week
    'days' => [
        'monday' => 'Monday',
        'tuesday' => 'Tuesday',
        // ...
    ],

    // Default opening hours
    'defaults' => [
        'monday' => ['09:00-17:00'],
        'tuesday' => ['09:00-17:00'],
        // ...
    ],

    // Exception types
    'exception_types' => [
        'closed' => 'Closed',
        'holiday' => 'Holiday',
        'special_hours' => 'Special Hours',
        'maintenance' => 'Maintenance',
        'event' => 'Special Event',
    ],
];
```

🎨 Component Options
-------------------

[](#-component-options)

### Form Component

[](#form-component)

```
// Complete form schema with all features
...OpeningHoursForm::schema()

// Features included:
// - Global enable/disable toggle
// - Searchable timezone selector
// - Collapsible day sections with duration display
// - Modal-based exception management
// - Recurring annual exceptions
// - Custom labels and descriptions
```

### Table Column Options

[](#table-column-options)

```
// Circular display (default)
OpeningHoursColumn::make('hours')
    ->circular()                    // Circular chart with day segments
    ->showTooltips()               // Hover tooltips with precise times
    ->showCurrentStatus()          // Center status indicator
    ->timezone('Africa/Algiers')   // Custom timezone

// Status badge
OpeningHoursColumn::make('status')
    ->status()                     // Badge with current status
    ->showTooltips()               // Next open/close times in tooltip

// Weekly overview
OpeningHoursColumn::make('weekly')
    ->weekly()                     // 7-day grid view with status dots
    ->showTooltips()               // Day details on hover
```

### Infolist Entry Options

[](#infolist-entry-options)

```
// Full details (default)
OpeningHoursEntry::make('hours')
    ->full()                       // Complete display with all sections
    ->showStatus()                 // Current status section
    ->showExceptions()             // Exceptions and holidays
    ->showTimezone()               // Timezone information

// Status only
OpeningHoursEntry::make('status')
    ->statusOnly()                 // Just current status with animation

// Weekly hours
OpeningHoursEntry::make('schedule')
    ->weeklyHours()                // Weekly schedule grid

// Compact summary
OpeningHoursEntry::make('summary')
    ->compact()                    // Minimal overview with stats
```

📊 Data Structure
----------------

[](#-data-structure)

The plugin stores data in this enhanced format:

```
{
    "opening_hours_enabled": true,
    "timezone": "Africa/Algiers",
    "opening_hours": {
        "monday": {
            "enabled": true,
            "hours": [
                {"from": "09:00", "to": "12:00"},
                {"from": "14:00", "to": "17:00"}
            ]
        },
        "tuesday": {
            "enabled": true,
            "hours": [{"from": "09:00", "to": "17:00"}]
        },
        "wednesday": {"enabled": false},
        // ... other days
    },
    "opening_hours_exceptions": {
        "2024-12-25": {
            "type": "holiday",
            "label": "Christmas Day",
            "note": "Merry Christmas!",
            "hours": [],
            "recurring": false
        },
        "12-31": {
            "type": "special_hours",
            "label": "New Year's Eve",
            "hours": [{"from": "09:00", "to": "15:00"}],
            "recurring": true
        }
    }
}
```

🎯 Advanced Features
-------------------

[](#-advanced-features)

### Exception Management

[](#exception-management)

- **Modal Interface**: Clean, intuitive exception management
- **Date Ranges**: Vacation periods, seasonal closures (e.g., July 1-15)
- **Recurring Exceptions**: Annual holidays (e.g., every December 25th)
- **Single Dates**: Specific holidays or one-time closures
- **Custom Labels**: Personalized exception names
- **Multiple Types**: Holiday, Closed, Special Hours, Maintenance, Events
- **Rich Descriptions**: Additional notes for each exception

### Visual Enhancements

[](#visual-enhancements)

- **Circular Charts**: SVG-based day segments with hover effects
- **Status Animations**: Pulsing indicators and progress bars
- **Gradient Styling**: Professional color schemes
- **Dark Mode**: Full dark theme support
- **Mobile Responsive**: Optimized for all devices

### Performance Features

[](#performance-features)

- **Lazy Loading**: Assets loaded only when needed
- **Efficient Queries**: Optimized database interactions
- **Caching Support**: Built-in cache compatibility
- **Error Handling**: Graceful degradation on errors

🔧 Multi-Tenancy Support
-----------------------

[](#-multi-tenancy-support)

Compatible with [stancl/tenancy](https://tenancyforlaravel.com/):

```
// In TenantPanelProvider (not OwnerPanelProvider)
->plugins([
    \KaraOdin\FilamentOpeningHours\OpeningHoursPlugin::make(),
])

// Tenant-specific migration
php artisan make:migration add_opening_hours_to_businesses --path=database/migrations/tenant

// Run across all tenants
php artisan tenants:migrate --path=database/migrations/tenant
```

📱 Browser Support
-----------------

[](#-browser-support)

- ✅ Chrome 80+
- ✅ Firefox 75+
- ✅ Safari 13+
- ✅ Edge 80+
- ✅ Mobile Safari
- ✅ Chrome Mobile

🚀 Requirements
--------------

[](#-requirements)

- PHP 8.1+
- Laravel 10.0+
- Filament 3.0+

🧪 Testing
---------

[](#-testing)

```
composer test
```

📝 Changelog
-----------

[](#-changelog)

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

🤝 Contributing
--------------

[](#-contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

🔒 Security Vulnerabilities
--------------------------

[](#-security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

🙏 Credits
---------

[](#-credits)

- [Nihat Mahdi](https://github.com/karaOdin)
- [All Contributors](../../contributors)
- Built on [spatie/opening-hours](https://github.com/spatie/opening-hours)
- Inspired by various business hours plugins

📄 License
---------

[](#-license)

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

---

🌟 Why Choose This Plugin?
-------------------------

[](#-why-choose-this-plugin)

### vs. Paid Alternatives

[](#vs-paid-alternatives)

- ✅ **Free &amp; Open Source**
- ✅ **More Features** than most paid plugins
- ✅ **Better Performance** with lazy loading
- ✅ **Modern UI/UX** with animations and gradients
- ✅ **Active Development** with regular updates

### Premium Features

[](#premium-features)

- 🎨 **Professional Design** - Matches Filament's aesthetic perfectly
- ⚡ **Performance Optimized** - Minimal impact on load times
- 🔧 **Highly Customizable** - Multiple display modes and options
- 📱 **Mobile First** - Responsive design for all devices
- 🌙 **Dark Mode Ready** - Full dark theme support
- ♿ **Accessibility** - WCAG compliant with proper ARIA labels

**Experience the difference - try it today!** 🚀

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance52

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

14

Last Release

296d ago

Major Versions

v1.0.3 → v2.0.02025-07-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/743296b9d8e6c6dcb6fb9f65310bfe76241c367fe4949b9d31b6d66bfcb82995?d=identicon)[karaOdin](/maintainers/karaOdin)

---

Top Contributors

[![karaOdin](https://avatars.githubusercontent.com/u/33878311?v=4)](https://github.com/karaOdin "karaOdin (19 commits)")

---

Tags

spatielaravelfilamentopening-hoursbusiness hours

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/karaodin-filament-opening-hours/health.svg)

```
[![Health](https://phpackages.com/badges/karaodin-filament-opening-hours/health.svg)](https://phpackages.com/packages/karaodin-filament-opening-hours)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[creagia/filament-code-field

A Filamentphp input field to edit or view code data.

58289.3k3](/packages/creagia-filament-code-field)[swisnl/filament-backgrounds

Beautiful backgrounds for Filament auth pages

54149.2k6](/packages/swisnl-filament-backgrounds)

PHPackages © 2026

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