Download the PHP package dragonmantank/sched without Composer

On this page you can find all versions of the php package dragonmantank/sched. 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 sched

Sched

A simple queue-based job scheduler and runner

Sched is a simple job runner and scheduler to schedule and run jobs. Using beanstalkd as a backend, it can arbitrarily invoke code based on jobs that come into tubes as well as schedule jobs using a cron syntax.

Installation

Sched is designed to be installed with your application and use your vendor and autoload settings. It is not meant to be run on it's own as a standalone application, though it does have it's own daemon.

If you are wanting to use the cron aspect of Sched, you will want to set up your system's cron to have Sched check every minute if a job is due:

Requirements

Usage

Running schedule requires starting the manager along with a configuration file. To run the the manager:

The manager will loop through all of the configured queues and process them in lots of 5. For example, if there are 10 messages in the queue, Sched will start up 2 workers, each handling 5 jobs. It will loop through the queues and constantly check the number of jobs against the number of workers.

Configuration

Sched requires a configuration file to know how to process your queues, and will ignore any queues that are not configured. You can also schedule jobs and custom commands through this same configuration file.

Queue Management

The queues section of the config file lets you define which queues you want to watch, and what code to pass the payload to (called a Worker). It is assumed that each payload is a JSON object.

For example, if you want to watch the download-payroll-report queue and have it processed by Me\MyApp\ReportDownloader\Payroll, you can figure it as such:

Me\MyApp\ReportDownloader\Payroll just needs to be an invokable class and implement the __invoke(array $payload): int signature.

You can also control the number of jobs that spawn per manager instance as well as per queue. By default Sched limits itself to 10 total jobs and 5 total jobs per queue, but this can be tweaked under the max_workers and max_workers_per_queue options under the manager config section.

Scheduling Jobs

You can also schedule jobs to run at specific times. Much like a queue worker, you can designate a worker to run at a specific time. Let's say we want our report downloader to fire at 4:00am every Saturday, to give our payroll system long enough to process and generate the report. We can specify a cron expression and the worker to do that:

Just like with the queue workers, the cron workers just need to be an invokable class that implements public function __invoke(): int (notice it does not take a $payload):

While the above example adds a job for the queue system to pick up and process, you can also run workers that process whatever is needed at the time without using the queues.

Custom Commands

There may come a time where you need to register a command directly with Sched instead of having it schedule jobs for you. For example, if you want to run a script every so often to queue up a bunch of files for processing but do not want it to be on a schedule, you can register a command with sched-manager that you can invoke. You can set a class name in the custom_commands array of the configuration file. This command must be a Symfony Console Command.

Logging

Sched supports PSR-3 compatible loggers in addition to writing to the console itself. If you supply an invokable class to the logger configuration key, Sched will inject that into the available commands where requested via dependency injection. Many of the commands will still write output to the console even if a proper logger is not used.

Sched makes available Dragonmantank\Sched\LoggingTrait as a trait to help write to the logger in your own commands. You can add this to your classes and then use $this->log($output, LogLevel::INFO, "My Message"); to log to the logger itself. This function will also log to the console depending on level of verbosity (-v, -vv, -vvv) supplied to the command.


All versions of sched with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
dragonmantank/cron-expression Version ^3.3
pda/pheanstalk Version ^4.0
vlucas/phpdotenv Version ^5.4
symfony/console Version ^6.0
php-di/php-di Version ^6.3
symfony/process Version ^6.0
psr/log Version ^2.0 || ^3.0
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 dragonmantank/sched contains the following files

Loading the files please wait ....