Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Hours Helper

Laravel Hours Helper Laravel Package

label84/laravel-hours-helper

Generate Laravel collections of time/date intervals for any period: build dropdown-ready schedules with custom formatting, exclusions, support for past-midnight ranges, and multi-day spans. Simple facade API to create evenly spaced slots like 08:00–09:30 every 30 minutes.

View on GitHub
Deep Wiki
Context7

Creates a Collection of times with a given interval.

Frequently asked questions about Laravel Hours Helper
How do I install label84/laravel-hours-helper in a Laravel project?
Run `composer require label84/laravel-hours-helper` in your project root. The package auto-registers via Laravel’s service provider discovery, so no additional configuration is needed.
What Laravel versions does this package support?
The package supports Laravel 11, 12, and 13. Check the [README](https://github.com/Label84/laravel-hours-helper) for version-specific release details.
Can I generate time slots that span past midnight (e.g., 23:00 to 01:00)?
Yes, the package handles past-midnight ranges seamlessly. For example, `HoursHelper::create('23:00', '01:00', 60)` will generate slots like 23:00, 00:00, and 01:00.
How do I exclude specific time ranges from the generated slots?
Pass an array of exclusion ranges to the `create()` method. For example, `HoursHelper::create('08:00', '11:00', 60, 'H:i', [['09:00', '09:59']])` will skip slots between 09:00 and 09:59.
Does this package work with multi-day time intervals (e.g., weekly schedules)?
Yes, you can generate slots across multiple days by specifying a start and end date with time. For example, `HoursHelper::create('2024-01-01 08:00', '2024-01-02 08:00', 60)` will include all hourly slots in that range.
Can I customize the output format of the generated time slots?
Absolutely. Use the fourth parameter of `create()` to specify a format string, like `'g:i A'` for 12-hour time (e.g., '11:00 AM') or `'Y-m-d H:i'` for full datetime strings.
Will this package work efficiently for large time ranges (e.g., monthly or yearly slots)?
For very large ranges, consider chunking or batching the generation to avoid memory issues. The package itself doesn’t enforce limits, but you may need to optimize how you process or store the results.
How can I integrate this with Livewire or frontend frameworks like React/Vue?
Return the generated Collection as JSON from a Laravel API endpoint or pass it directly to Blade templates. For Livewire, use `$this->emit()` to push slots to the frontend, or for React/Vue, fetch the JSON via an API call.
Does this package support timezone handling beyond Laravel’s default timezone?
The package uses Laravel’s default timezone (configured in `config/app.php`). For multi-timezone support, manually integrate Carbon’s `CarbonTimeZone` to generate slots in specific timezones before formatting.
Are there alternatives to this package for generating time intervals in Laravel?
Yes, you could use Carbon’s `copy()` and `addMinutes()` methods manually or leverage frontend libraries like FullCalendar for client-side generation. However, this package offers a Laravel-native, opinionated API tailored for server-side scheduling.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope