Express crontabs as human friendly phrases

Overview

Build Status

CRON Lingo

CronLingo turns human readable strings about time and turns them into valid crontabs.

Examples:

echo CronLingo::fromExpression('Every day at midnight');
// "0 0 * * *"

echo CronLingo::fromExpression('Every 15 minutes at midnight on the weekend');
// "*/15 0 * * 0,6"

echo CronLingo::fromExpression('Every other minute in August at noon on a weekday');
// "*/2 12 * 8 1,2,3,4,5"

echo CronLingo::fromExpression('The 1st day in April at midnight');
// "0 0 1 4 *"

echo CronLingo::fromExpression('Every day on the weekday at 2:25pm');
// "25 14 * * 1,2,3,4,5"

Syntax

CronLingo identifies the parts of a string with specific time-related keywords such as "on, to, at" and uses this to deduce the time meaning and convert it into part of a cron tab. It's not particular about the order of these statements. Here's a brief list of things that it will pick up and parse into a crontab:

  • Periods (daily, weekly, monthly)
  • Exact times (9:30 PM, 8a, 3p)
  • Meridiems (AM/PM/A/P)
  • Intervals (1st, second, other, ninth, etc)
  • Specific fields (second, minute, hour, day, month)
  • Day of week (sunday, monday, etc)
  • 12 o'clocks (noon, midnight)
  • Lists (e.g., 5 to 12 minutes)
  • Month names (january, february, etc)
  • Weekend / weekday

What's a cron tab?

A cron tab is an expression that defines a recurring period of time.

It looks something like this:

*    *    *    *    *
-    -    -    -    -
|    |    |    |    |
|    |    |    |    +----- day of week (0 - 7) (Sunday=0 or 7)
|    |    |    +---------- month (1 - 12)
|    |    +--------------- day of month (1 - 31)
|    +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)

From Wikipedia:

The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration—though its general-purpose nature makes it useful for things like connecting to the Internet and downloading email at regular intervals.

You might also like...
PHP implementation of Rapid Automatic Keyword Exraction algorithm (RAKE) for extracting multi-word phrases from text

PHP implementation of Rapid Automatic Keyword Exraction algorithm (RAKE) for extracting multi-word phrases from text.

Extract colors from an image like a human would do.

ColorExtractor Extract colors from an image like a human would do. Install Via Composer $ composer require league/color-extractor:0.3.* Usage require

Extract colors from an image like a human would do.

ColorExtractor Extract colors from an image like a human would do. Install Via Composer $ composer require league/color-extractor:0.3.* Usage require

OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures  all the essential functionalities required for any enterprise.
OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures all the essential functionalities required for any enterprise.

OrangeHRM Open Source Application OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures all the essential functionalities

The new, most powerful Comic Reader ever created by the human race. Reworked by an Otaku.
The new, most powerful Comic Reader ever created by the human race. Reworked by an Otaku.

FoOlSlideX The new, most powerful Comic Reader ever created by the human race. Reworked by an Otaku. Requirements PHP greater than 7.0 and everything

STEAM education curriculum centered on building a new civilization entirely from trash, which provides all human needs for free directly to the local community

TRASH ACADEMY STEAM(Science Technology Engineering Art Math) education curriculum centered around building self-replicating technology from trash whic

Instagram automation represents the use of third-party software to manage your account, carry out tasks and/or interact with users without a human present.  Bulit in Laravel Framework
Instagram automation represents the use of third-party software to manage your account, carry out tasks and/or interact with users without a human present. Bulit in Laravel Framework

How to Deploy laravel project to heroku Video Link : https://youtu.be/7Nq_a2QiaHo Home Page Login Page Dashboard Page About Laravel Laravel is a web a

Automatic human timestamps for Laravel Eloquent models.

Automatic human timestamp properties in Laravel This package provides a trait you can add to an Eloquent model that will automatically create human-re

Text - An experiment with WebSockets and the human condition.

An experiment with WebSockets and the human condition. I wanted to learn how to use WebSockets in pure PHP and JavaScript, so I came up with the simpl

🧾 Online test site with the human sciences theme. Using: HTML5, CSS3, Js., PHP7 and MySQL. 🚀
🧾 Online test site with the human sciences theme. Using: HTML5, CSS3, Js., PHP7 and MySQL. 🚀

form-ciencias-humanas 🚀 Technologies Lunacy HTML5 CSS3 PHP7 MYSQL Animate.css Illustrations from icons8: Earth care from Anna Antipina Earth and Moon

ColorExtractor: Extract colors from an image like a human would do

ColorExtractor Extract colors from an image like a human would do. Install Via Composer $ composer require league/color-extractor:0.3.* Usage require

Sentrifugo is a FREE and powerful Human Resource Management System (HRMS) that can be easily configured to meet your organizational needs.

Sentrifugo Sentrifugo is a free and powerful new-age Human Resource Management System that can be easily configured to adapt to your organizational pr

🦉 human-readable regular expressions for PHP

RegExpBuilder integrates regular expressions into the programming language, thereby making them easy to read and maintain. Regular Expressions are created by using chained methods and variables such as arrays or strings.

Requests - a HTTP library written in PHP, for human beings

Requests is a HTTP library written in PHP, for human beings. It is roughly based on the API from the excellent Requests Python library. Requests is ISC Licensed (similar to the new BSD license) and has no dependencies, except for PHP 5.6+.

Herbie is a simple Flat-File CMS- und Blogsystem based on human readable text files

Herbie is a simple Flat-File CMS- und Blogsystem based on human readable text files

This component, based on the Symfony serializer and async-aws, is a human-readable and quick abstraction to easily store serialized objects in DynamoDB 🚀.

DynamoDB Storable This component, based on the Symfony serializer and async-aws, is a human-readable and quick abstraction to easily store serialized

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

PHPMD PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly

😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.
😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.

Tracy - PHP debugger Introduction Tracy library is a useful helper for everyday PHP programmers. It helps you to: quickly detect and correct errors lo

Comments
  • README does not match implementation

    README does not match implementation

    The README shows CronLingo::fromExpression("string") as the parser method, looks like the actual code has a CronLingo::cron("string") method.

    I'll submit a couple of patches, can't quite tell which method name you prefer. fromExpression seems pretty reasonable though, conveys the true intention of the method. cron is a little vague. Could also be parse or whatever.

    PS - I like it! :)

    opened by codenamegary 2
  • Scrutinizer Auto-Fixes

    Scrutinizer Auto-Fixes

    @ajbdev requested this pull request.

    It consists of patches automatically generated for this project on Scrutinizer: https://scrutinizer-ci.com/g/ajbdev/cronlingo/

    opened by scrutinizer-auto-fixer 0
  • Scrutinizer Auto-Fixes

    Scrutinizer Auto-Fixes

    @ajbdev requested this pull request.

    It consists of patches automatically generated for this project on Scrutinizer: https://scrutinizer-ci.com/g/ajbdev/cronlingo/

    opened by scrutinizer-auto-fixer 0
  • Scrutinizer Auto-Fixes

    Scrutinizer Auto-Fixes

    @ajbdev requested this pull request.

    It consists of patches automatically generated for this project on Scrutinizer: https://scrutinizer-ci.com/g/ajbdev/cronlingo/

    opened by scrutinizer-auto-fixer 0
Releases(v0.1.1)
Owner
programmer
null
Instagram automation represents the use of third-party software to manage your account, carry out tasks and/or interact with users without a human present. Bulit in Laravel Framework

How to Deploy laravel project to heroku Video Link : https://youtu.be/7Nq_a2QiaHo Home Page Login Page Dashboard Page About Laravel Laravel is a web a

null 1 Dec 3, 2021
Express crontabs as human friendly phrases

CRON Lingo CronLingo turns human readable strings about time and turns them into valid crontabs. Examples: echo CronLingo::fromExpression('Every day a

null 149 Dec 30, 2022
cybercog 996 Dec 28, 2022
Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP.

express.php Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP. Features Fast The Library is handles requests fast and

null 5 Aug 19, 2022
🦭 Kirby, but headless only – KQL with bearer token, Express-esque middlewares & more

Kirby Headless Starter ℹ️ Send a Bearer test authorization header with a request to the live playground to test this headless starter. This starter ki

Johann Schopplich 36 Dec 28, 2022
PHPRouter is an easy-to-use, fast, and flexible PHP router package with express-style routing.

PHP-Router is a modern, fast, and adaptable composer package that provides express-style routing in PHP without a framework.

Ayodeji O. 4 Oct 20, 2022
On International Talk Like a Pirate Day (September 19th), this filter changes all appropriate English phrases and words into pirate-speak.

Pirate This module is a simple filter that, when enabled, will change your posts to "Pirate talk" on September 19th for Talk like a Pirate Day Install

Backdrop CMS contributed projects 3 Oct 26, 2021
Composer package providing HTTP Methods, Status Codes and Reason Phrases for PHP

HTTP Enums For PHP 8.1 and above This package provides HTTP Methods, Status Codes and Reason Phrases as PHP 8.1+ enums All IANA registered HTTP Status

Alexander Pas 72 Dec 23, 2022
Searches for multilingual phrases in Laravel project and automatically generates language files for you.

Laravel Lang Generator Searches for multilingual phrases in a Laravel project and automatically generates language files for you. You can search for n

Gleb 5 Oct 19, 2022