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
Cron Translator

Cron Translator Laravel Package

lorisleiva/cron-translator

Make CRON expressions human-readable in PHP/Laravel. Translate schedules like “*/2 * * * *” into natural language (“Every 2 minutes”), with optional locale and 24-hour time formatting. Supports many languages (en, fr, de, es, etc.).

View on GitHub
Deep Wiki
Context7

Makes CRON expressions human-readable

Frequently asked questions about Cron Translator
How do I install and use Cron Translator in a Laravel project?
Run `composer require lorisleiva/cron-translator` to install. Use the static method `CronTranslator::translate('* * * * *')` directly or bind it as a singleton in `AppServiceProvider` for Laravel’s container. No configuration is needed for basic usage.
Does this package support Laravel’s localization system (e.g., `App::getLocale()`)?
Yes. Pass the locale as a second argument: `CronTranslator::translate('0 12 * * *', 'fr')` for French. It integrates with Laravel’s i18n ecosystem and supports 18+ locales out of the box.
Can I use 24-hour time formatting for cron translations?
Absolutely. Add a third boolean argument: `CronTranslator::translate('30 18 * * *', 'en', true)` forces 24-hour format (e.g., `18:30`). Defaults to 12-hour for most locales.
What Laravel versions and PHP versions are supported?
The package requires **PHP 8.2+** and is optimized for **Laravel 9+**. It’s stateless and dependency-free, so it won’t conflict with older Laravel versions, but some features (like facades) assume Laravel’s service container.
How can I integrate this into Laravel’s Artisan commands or middleware?
Bind the translator as a singleton in `AppServiceProvider` and inject it into commands or middleware. For example, create a `cron:translate` Artisan command to debug cron expressions in CLI: `php artisan cron:translate '0 * * * *'`.
Does Cron Translator handle extended cron syntax (e.g., `@yearly`, `L`, `W`)?
No. It supports **standard 5-part cron syntax** (minute, hour, day, month, weekday). For extended syntax, pre-process expressions (e.g., convert `@yearly` to `0 0 1 1 *`) or use a custom wrapper to handle unsupported patterns.
Is there a performance impact when translating cron expressions in hot paths (e.g., API responses)?
Translation is **O(1) for simple cron** and typically adds **<1ms** even for complex expressions. For high-frequency use (e.g., API responses), cache results with Laravel’s `Cache::remember()` to avoid repeated parsing.
How can I contribute missing translations or fix locale issues?
Check the [GitHub repository](https://github.com/lorisleiva/cron-translator) for contribution guidelines. Submit a PR with updated locale files or open an issue to report inconsistencies. The package welcomes community-driven localization.
Can I use this package in non-Laravel PHP projects?
Yes. It’s a **standalone utility** with no Laravel dependencies. Use `require 'vendor/autoload.php'` and call `CronTranslator::translate()` directly. However, Laravel-specific features (like facades or service binding) won’t work outside Laravel.
Are there alternatives to Cron Translator for Laravel?
For basic cron translation, alternatives include `spatie/cron-expression` (focused on parsing) or custom solutions using `DateTime` logic. However, Cron Translator uniquely combines **human-readable output**, **multi-language support**, and **Laravel-native integration** in a single package.
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.
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
anil/file-picker
broqit/fields-ai