Download the PHP package wangruyi/php-crond without Composer

On this page you can find all versions of the php package wangruyi/php-crond. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-crond

PHP-Crond

一个简单易用的PHP定时任务调度框架,通过创建子进程执行定时任务,支持Cron表达式,轻量级且易于集成到现有项目中。

特性

安装

快速开始

基本使用

Job构造函数参数说明

Job类的构造函数声名如下:

输出日志与FileOutput

框架内置了 FileOutput 类,可以自动按日期分割日志文件。在$output参数中使用 {Ymd} 等占位符即可启用日期分割。例如:

这将在 log 目录下生成类似 echo_20250101.log 的日志文件。

如果不使用占位符,日志将始终写入同一个文件。

setOutput 方法

Job 类还提供了 setOutput 方法,允许在运行时动态更改输出文件路径。该方法同样支持日期变量替换,用法与构造函数中的 $output 参数一致。例如:

调度器 Scheduler

Scheduler 负责管理所有任务,并在无限循环中检查并执行到达时间的任务。

主要方法:

与ThinkPHP集成示例

ThinkPHP用户可以在自定义Command中调用调度器:

注意事项

  1. 运行环境:本框架仅能在CLI模式下运行,不可用于Web请求。
  2. Windows支持:在Windows系统下,命令构建会自动适配(使用 cmd /C),但复杂命令可能需要测试。
  3. 日志目录:请确保输出日志文件所在的目录存在且可写,否则任务可能执行失败。
  4. 长时间运行:调度器启动后会无限循环执行,请使用进程管理工具(如Supervisor)来管理服务。
  5. Cron表达式:仅支持到分钟级别,秒级不支持;如果任务没有按预期执行,请检查Cron表达式是否正确。

贡献

欢迎提交Issue和Pull Request来改进本项目。

许可证

本项目基于MIT许可证开源。


All versions of php-crond with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
symfony/process Version ^5.4
monolog/monolog Version ^2.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wangruyi/php-crond contains the following files

Loading the files please wait ...