Download the PHP package konnco/filament-timematrix without Composer
On this page you can find all versions of the php package konnco/filament-timematrix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download konnco/filament-timematrix
More information about konnco/filament-timematrix
Files in konnco/filament-timematrix
Package filament-timematrix
Short Description A Filament form component for selecting time slots across days
License MIT
Homepage https://github.com/konnco/filament-timematrix
Informations about the package filament-timematrix
Filament Time Matrix
An interactive Filament form component for selecting time slots across days with powerful validation and manipulation features.
Features
- 📅 Interactive day/hour matrix with bulk selection
- ✅ Select all hours/days/slots at once
- 🔄 Reset functionality
- 🔢 Real-time slot counter
- 👁️ Read-only infolist entry for displaying schedules
- 🛠️ Facade for validation & manipulation
- 🌍 Multi-language support via Carbon
- 🎨 Dark mode support
Requirements
- PHP: 8.1 or higher
- Filament: 3.0, 4.0, or 5.0
- Laravel: 10.0, 11.0, 12.0, or 13.0
- Carbon: 2.0 or 3.0 or higher
Installation
Quick Start
Simple Usage
This will create a time matrix with:
- All 7 days of the week (Monday - Sunday)
- All 24 hours (0-23)
- Select all hours/days buttons enabled
- Using your app's default locale
Complete Usage
Available Methods
| Method | Description | Example |
|---|---|---|
hours(int $startTime, int $endTime) |
Set custom hour range (0-23) | ->hours(8, 18) |
businessHours(int $startTime, int $endTime) |
Shortcut for business hours | ->businessHours(9, 17) |
days(array $days) |
Set specific days (Day enum or Carbon constants) | ->days([Day::MONDAY, Day::FRIDAY]) |
weekdays() |
Monday to Friday only | ->weekdays() |
weekend() |
Saturday and Sunday only | ->weekend() |
locale(?string $locale, string $format) |
Set locale and format (long/short/min) | ->locale('id', 'short') |
showSelectAllHours(bool $show) |
Show/hide select all hours button | ->showSelectAllHours(false) |
showSelectAllDays(bool $show) |
Show/hide select all days button | ->showSelectAllDays(false) |
Infolist Display
Use the dedicated infolist entry to render a saved schedule as a read-only matrix (active slots are highlighted, no interactive checkboxes).
It shares the same configuration methods as the form component:
| Method | Description | Example |
|---|---|---|
hours(int $startTime, int $endTime) |
Set custom hour range (0-23) | ->hours(8, 18) |
businessHours(int $startTime, int $endTime) |
Shortcut for business hours | ->businessHours(9, 17) |
days(array $days) |
Set specific days (Day enum) | ->days([Day::MONDAY, Day::FRIDAY]) |
weekdays() |
Monday to Friday only | ->weekdays() |
weekend() |
Saturday and Sunday only | ->weekend() |
locale(?string $locale, string $format) |
Set locale and format (long/short) | ->locale('id', 'short') |
Tip: Configure the infolist entry with the same
hours()/days()as the form so the displayed grid matches what was selected.
Facade Methods Reference
isActiveAt(array $data, ?Carbon $dateTime = null): bool
Check if time slot is active at a specific time or now (default).
Parameters:
$data(array): The time matrix data$dateTime(Carbon|null, optional): DateTime to check. Defaults to now()
Returns: bool
Examples:
hasActiveDay(array $data, string|Day|null $day = null): bool
Check if there are active slots on a specific day or today (default).
Parameters:
$data(array): The time matrix data$day(string|Day|null, optional): Day to check. Defaults to today
Returns: bool
Examples:
getActiveHours(array $data, string|Day|null $day = null): array
Get active hours for a specific day or today (default).
Parameters:
$data(array): The time matrix data$day(string|Day|null, optional): Day to get hours from. Defaults to today
Returns: array - Array of hours like [8, 9, 10, 14, 15]
Examples:
Validation Methods
validate(array $data): bool
Validate the structure of time matrix data.
Example:
hasSelection(array $data): bool
Check if there is at least one selected slot.
Example:
Statistics Methods
isFullyActive(array $data): bool
Check if schedule is 24/7 (all days, all hours).
Example:
getTotalActiveHours(array $data): int
Get total active hours per week.
Example:
getActivePercentage(array $data): float
Get percentage of active hours (0-100).
Example:
getActiveDays(array $data): array
Get days that have at least one active hour.
Returns: Array of Day enums
Example:
isDayHourActive(array $data, string|Day $day, int $hour): bool
Check if a specific day and hour combination is active.
Example:
Time Query Methods
getNextAvailableSlot(array $data, Carbon $from): ?Carbon
Get next available slot from a specific time.
Example:
getSlotsInRange(array $data, Carbon $start, Carbon $end): array
Get all slots within a date range.
Example:
toCarbonSlots(array $data, ?Carbon $referenceWeek = null): array
Convert to Carbon instances for a specific week.
Example:
Formatting Methods
toReadableFormat(array $data): array
Convert to simplified format.
Returns: ['monday' => [8, 9, 10], 'tuesday' => [14, 15]]
Example:
formatDaySchedule(array $data, string|Day $day): string
Format single day to human-readable string.
Returns: String like "08:00-10:59, 14:00-16:59"
Example:
formatAllDays(array $data, ?string $locale = null): array
Format all days with localized labels.
Example:
Real-World Usage Examples
1. Check Merchant Status
2. Display in Infolist
API Methods Summary
Smart Default Methods (NEW!)
| Method | Default Behavior | Usage |
|---|---|---|
isActiveAt($data, ?$dateTime) |
Checks now if no param | isActiveAt($data) |
hasActiveDay($data, ?$day) |
Checks today if no param | hasActiveDay($data) |
getActiveHours($data, ?$day) |
Gets today's hours if no param | getActiveHours($data) |
All Available Methods
| Method | Return Type | Description |
|---|---|---|
validate($data) |
bool |
Validate structure |
hasSelection($data) |
bool |
Check if has selections |
isActiveAt($data, ?$dateTime) |
bool |
Check active at time (default: now) |
hasActiveDay($data, ?$day) |
bool |
Check day has active slots (default: today) |
getActiveHours($data, ?$day) |
array |
Get active hours (default: today) |
isFullyActive($data) |
bool |
Check if 24/7 |
getTotalActiveHours($data) |
int |
Total hours per week |
getActivePercentage($data) |
float |
Coverage percentage |
getActiveDays($data) |
array<Day> |
Days with active slots |
isDayHourActive($data, $day, $hour) |
bool |
Check specific day+hour |
getNextAvailableSlot($data, $from) |
?Carbon |
Next available slot |
getSlotsInRange($data, $start, $end) |
array<Carbon> |
Slots in range |
toCarbonSlots($data, ?$week) |
array<Carbon> |
Convert to Carbon |
formatDaySchedule($data, $day) |
string |
Format single day |
formatAllDays($data, ?$locale) |
array |
Format all days |
toReadableFormat($data) |
array |
Simplified format |
License
MIT License. See LICENSE for details.
Credits
- Konnco Studio
- All Contributors
Support
For issues and feature requests, please use the GitHub issue tracker.
All versions of filament-timematrix with dependencies
filament/filament Version ^3.0|^4.0|^5.0
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
nesbot/carbon Version ^2.0|^3.0