appsketch / human-cron
A laravel package for converting a cron string to a 'time ago' or a 'time from now' string.
This package's canonical repository appears to be gone and the package has been frozen as a result.
v1.0.0
2015-07-26 19:22 UTC
Requires
- mtdowling/cron-expression: ^1.0
- nesbot/carbon: ^1.20
Requires (Dev)
- phpspec/phpspec: ~2.0
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2024-02-03 14:53:15 UTC
README
Installation
First, pull in the package through Composer.
composer require appsketch/human-cron
And then, if using Laravel 5.1, include the service provider within app/config/app.php
.
'providers' => [ Appsketch\HumanCron\Providers\HumanCronServiceProvider::class, ]
if using Laravel 5. include this service provider.
'providers' => [ "Appsketch\HumanCron\Providers\HumanCronServiceProvider", ]
The alias will automatically set.
Usage
Within, for example the routes.php add this.
Route::get('/cron', function() { // Cron $cron = '0,30 * * * * *'; // Will echo e.g. '1 minute from now' echo HumanCron::cron($cron)->next(); // Will echo e.g. '2 minutes ago' echo HumanCron::cron($cron)->previous(); // Will print an array with both; next and previous. print_r(HumanCron::cron($cron)->both()); });