{"id":21762822,"url":"https://github.com/visavi/crontask","last_synced_at":"2025-04-13T13:41:14.834Z","repository":{"id":57078318,"uuid":"107526910","full_name":"visavi/crontask","owner":"visavi","description":"This package contains a simple PHP cron task scheduler that helps you version control your cron jobs.","archived":false,"fork":false,"pushed_at":"2021-05-15T16:56:30.000Z","size":10,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T04:41:32.315Z","etag":null,"topics":["cron","crontab","php","scheduler","task"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/visavi.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-19T09:35:16.000Z","updated_at":"2024-03-10T12:33:50.000Z","dependencies_parsed_at":"2022-08-24T13:10:46.245Z","dependency_job_id":null,"html_url":"https://github.com/visavi/crontask","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visavi%2Fcrontask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visavi%2Fcrontask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visavi%2Fcrontask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visavi%2Fcrontask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visavi","download_url":"https://codeload.github.com/visavi/crontask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550628,"owners_count":21122930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cron","crontab","php","scheduler","task"],"created_at":"2024-11-26T12:13:15.434Z","updated_at":"2025-04-13T13:41:14.814Z","avatar_url":"https://github.com/visavi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Cron tasks\n============\n\n[![Total Downloads](https://poser.pugx.org/visavi/crontask/downloads)](https://packagist.org/packages/visavi/crontask)\n[![Latest Stable Version](https://poser.pugx.org/visavi/crontask/v/stable)](https://packagist.org/packages/visavi/crontask)\n[![Latest Unstable Version](https://poser.pugx.org/visavi/crontask/v/unstable)](https://packagist.org/packages/visavi/crontask)\n[![License](https://poser.pugx.org/visavi/crontask/license)](https://packagist.org/packages/visavi/crontask)\n\nIntroduction\n------------\n\nThis package contains a simple PHP cron task scheduler that helps you version control your cron jobs.\n\nRequirements\n------------\n\nThis library package requires PHP 7.0 or later\n\nInstallation\n------------\n\n### Installing via Composer\n\nThe recommended way to install crontask is through\n[Composer](http://getcomposer.org).\n\nNext, run the Composer command to install the latest version of crontask:\n\n```bash\ncomposer require visavi/crontask\n```\n\nAfter installing, you need to require Composer's autoloader:\n\n```php\nrequire 'vendor/autoload.php';\n```\n\nOnce you've created your task list script (see Usage below) open a linux shell add the following line to crontab (crontab -e):\n\n```\n* * * * * php /path/cron.php\n``` \n\nUsage\n-----\n\nThe following example shows how to schedule a HelloDaily task (simple echo example) and a ShellMonday task (running a shell task example).\n\n```php\nclass HelloDailyTask extends \\Crontask\\Tasks\\Task\n{\n    public function run()\n    {\n        $this-\u003esetOutput('Hello World');\n    }\n}\n\nclass ShellMondayTask extends \\Crontask\\Tasks\\Shell\n{\n    protected $command = \"echo Hello Monday\";\n}\n\n$taskList = new \\Crontask\\TaskList();\n\n// Add task to run at 12:00 every day\n$taskList-\u003eaddTask((new HelloDailyTask)-\u003esetExpression('12 0 * * *'));\n\n// Add task to run every hour\n$taskList-\u003eaddTask((new HelloDailyTask)-\u003esetExpression('@hourly'));\n\n// Add task to run at 12:00 every Monday\n$taskList-\u003eaddTask((new ShellMondayTask)-\u003esetExpression('12 0 * * 1'));\n\n// or\n$taskList-\u003eaddTasks([\n    (new HelloDailyTask)-\u003esetExpression('12 0 * * 1'),\n    (new HelloDailyTask)-\u003esetExpression('@hourly'),\n    (new ShellMondayTask)-\u003esetExpression('12 0 * * 1'),\n]);\n\n$taskList-\u003erun();\n```\n\nCRON Expressions\n----------------\n\nA CRON expression is a string representing the schedule for a particular command to execute.  The parts of a CRON schedule are as follows:\n\n    *    *    *    *    *\n    -    -    -    -    -\n    |    |    |    |    |\n    |    |    |    |    |\n    |    |    |    |    +----- day of week (0 - 7) (Sunday=0 or 7)\n    |    |    |    +---------- month (1 - 12)\n    |    |    +--------------- day of month (1 - 31)\n    |    +-------------------- hour (0 - 23)\n    +------------------------- min (0 - 59)\n\nMappings\n--------\n```\n@yearly   =\u003e 0 0 1 1 *\n@annually =\u003e 0 0 1 1 *\n@monthly  =\u003e 0 0 1 * *\n@weekly   =\u003e 0 0 * * 0\n@daily    =\u003e 0 0 * * *\n@hourly   =\u003e 0 * * * *\n```\n\n### License\n\nThe class is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisavi%2Fcrontask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisavi%2Fcrontask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisavi%2Fcrontask/lists"}