Download the PHP package tobento/service-schedule without Composer

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

Schedule Service

A task schedule system for running tasks at specific intervals.

Table of Contents

Getting started

Add the latest version of the schedule service project running this command.

Requirements

Highlights

Documentation

Usage

Scheduling Tasks

To schedule a task you may use the default Schedule or create your own fitting your needs.

Running Scheduled Tasks

The most common way to run the schedule processor is a Cron job that runs the schedule:run every minute. The following should be added to your production server's crontab:

Example of console.php

Example using the Console Service, Clock Service and Container Service:

Tasks

Callable Task

Check out the Task Parameters.

Invokable objects

You may consider using invokable objects that contain an method:

Command Task

The command task may be used to run the provided command using the Console Service.

Check out the Task Parameters.

Requirements

This command task requires the Console Service:

Invokable Task

You may create invokable tasks by simply extending the . The method will be called when the task is being processed.

Check out the Task Parameters.

Ping Task

The ping task may be used to ping the provided URI.

Check out the Task Parameters.

Requirements

This ping task requires Guzzle, PHP HTTP client:

Process Task

The process task may be used to execute shell commands using the Symfony Process Component.

Check out the Task Parameters.

Requirements

This process task requires the Symfony Process Component:

Task Methods

All of the available Tasks supporting the following methods.

General Task Methods

Schedule Task Methods

Check out the Task Schedule section for the available task schedules.

You may consider using the cron generator already available:

Check out the Cron Expression Generator for more examples.

Task Schedule

Cron Expression

You may use the to define at which interval you want to run the task.

You may consider using the cron generator already available:

Check out the Cron Expression Generator for more examples.

Dates

You may use the to run tasks at specific dates every year.

Task Parameters

You may use the available parameters providing basic features for tasks or create custom parameters to add new features or customizing existing to suit your needs.

All of the available Tasks supporting the following parameters and its helper methods.

After Parameter

The after parameter executes the specified handler after the task is processed.

The will be passed to your handler. In addition, you may request any service being resolved (autowired) by the container passed to the task processor.

Before Parameter

The before parameter executes the specified handler before the task is processed.

The will be passed to your handler. In addition, you may request any service being resolved (autowired) by the container passed to the task processor.

Skip Task

You may throw a if you want to prevent the task from being processed not resulting in a failure.

Failed Parameter

The failed parameter executes the specified handler if the task fails.

The will be passed to your handler. In addition, you may request any service being resolved (autowired) by the container passed to the task processor.

Mail Parameter

The mail parameter may be used to send mails using the Mail Service before and/or after tasks are processed or when a task fails.

In addition, you may use the , and helper methods:

Requirements

This parameter requires the Mail Service:

First, install the mail service:

Finally, it requires the to be binded to your container passed to the Task Processor:

Example using the Container Service:

Message From Address

If you do not have defined a default from address, you will need to set it:

Message Contents

You may set a message subject otherwise the task name will be used instead:

A sent mail looks like:

Monitor Parameter

The monitor parameter may be used to monitor tasks processes such as the start time, running time and memeory usage.

Ping Parameter

The ping parameter may be used to ping the provided URI.

A header will be added to the request with a , or value depending on its processing state.

In addition, you may use the , and helper methods:

Requirements

This parameter requires Guzzle, PHP HTTP client:

Send Result To Parameter

The send result to parameter may be used to send the task result to the specified file.

In addition, you may use the and helper methods:

Skip Parameter

The skip parameter may be used to skip tasks if the parameter evalutes to . The parameter has a default priority of whereby it gets handled before any lower prioritized task parameters.

If using a callable, the will be passed to your callback function. In addition, you may request any service being resolved (autowired) by the container passed to the task processor.

Without Overlapping Parameter

The without overlapping parameter may be used to prevent tasks from overlapping.

Requirements

The parameter requires a to be binded to your container passed to the Task Processor:

Example using the Cache Service and Container Service:

Task Processor

The is responsible for processing tasks.

Process Task

Check out the Task Result to learn more.

Task Result

Task Results

Schedule

Example adding tasks

Check out the Tasks section for more information about the individual tasks.

Schedule Processor

The schedule processor is responsible for processing the scheduled tasks which are due.

Process Scheduled Task

To process tasks when they are due, the method should be called every minute indefinitely.

You may create a custom schedule processor fitting your needs though.

Check out the Task Results to learn more.

Console

You may use the following commands using the Console Service.

To get quickly started consider using the following two app bundles:

Otherwise, you need to install the Console Service and set up your console by yourself. Check out the Running Scheduled Tasks section to see a possible implementation.

Run Command

Running due tasks

Running specific tasks by its id

List Command

Lists all tasks.

Events

Available Events

Event Description
The event will dispatch before the schedule is processed
The event will dispatch after the schedule is processed
The event will dispatch before the task is processed
The event will dispatch after the task is processed

Just make sure you pass an event dispatcher to the Schedule Processor!

Learn More

Running Scheduled Tasks Without Console

Another way to run the schedule processor is a Cron job that runs your schedule.php script every minute. The following should be added to your production server's crontab:

Example of schedule.php

Example using the Container Service:

Credits


All versions of service-schedule with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
psr/container Version ^2.0
psr/clock Version ^1.0
psr/simple-cache Version 2 - 3
psr/event-dispatcher Version ^1.0
tobento/service-autowire Version ^1.0.9
tobento/service-file-creator Version ^1.0.1
tobento/service-collection Version ^1.0.5
dragonmantank/cron-expression Version ^3.1
butschster/cron-expression-generator Version ^1.10
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 tobento/service-schedule contains the following files

Loading the files please wait ....