Download the PHP package lekoala/silverstripe-simple-jobs without Composer

On this page you can find all versions of the php package lekoala/silverstripe-simple-jobs. 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 silverstripe-simple-jobs

SilverStripe Simple Jobs

Build Status scrutinizer Code coverage

An alternative to run cron jobs that uses simple HTTP requests.

This module require SilverStripe CronTask.

Why?

Configuring cron jobs is painful. Maybe you don't have proper access to your server, or maybe it's difficult to make sure that php is run under the right user. This is why you can simply rely on an external service to trigger a HTTP request to a given script that will take care of any task you have to run.

How to setup

Using an external service

Simply call every 5 minutes the following url : yoursite.com/simple-jobs/trigger

In order to do that, you can use for example UptimeRobot. As an added bonus, will you monitor if your webserver is responding which is always nice to have :-).

Using your own requests

Don't like using a service like UptimeRobot ? Feel free to setup your own http requets using Windows Scheduled Tasks or another server using cron.

For instance

* * * * * wget -O - http://yoursite.com/simple-jobs/trigger >/dev/null 2>&1

Using regular cron jobs

You can also use this module similarly to the base crontask module, while getting all the logging benefits.

Add the following command to your cron definition:

* * * * * www-data /usr/bin/php /path/to/silverstripe/docroot/framework/cli-script.php simple-jobs/trigger

Enabling BasicAuth

To prevent malicious users to hammer your website by calling the url, you can enable BasicAuth. Define the following in your config file:

And make sure that the proper headers are sent by UptimeRobot or any system you use to trigger HTTP requests.

Testing

You can also test your tasks by visiting yoursite.com/simple-jobs/.

This is enabled only if Dev mode is active. You can click on any task in the list, and choose to run it according to its schedule or force the task to run.

If needed, you can also trigger manually your jobs. Simply visit /simple-jobs/trigger_manual/YourClass.

Log results

As an added bonus, this module will by default log all results returned by the process() method. It will be stored in the database for further analysis.

Any task returning "false" will be marked as Failed.

Any task that triggers an exception will be marked as Failed and the Exception will be stored as the result. This has also the side benefit of allowing other tasks to be run even if one of them raise an exception.

Predefined schedules

If you don't like the cron syntax, you can also use any constant from the SimpleJobSchedules class, that provides sane defaults for most common schedules.

It also comes with two methods: everyDay and everyWeek, that allow you to define the task to run on a specific hour or day in the week. This is useful if you have multiple daily or weekly task and that you don't want to run them at the same time (because it could cause a timeout).

Simple Tasks

This module also has a limited job runner feature in form of the SimpleTask class. A simple task is simply a delayed call to a given method on a given DataObject. You can pass any number of json serializable parameters (not object instances, for example).

One simple task can have many calls to any number of methods on any number of object instances. Keep in mind that the SimpleJobsController will only run one task each time (every 5 minutes or less depending on how you configured the module), so you may want to group in one simple task everything that is related to one specific process.

Cleaning sessions

Since we have the session-manager, we need to clean sessions.

This module does it for you automatically daily. This can be disabled:

Compatibility

Tested with 5+

Maintainer

LeKoala - [email protected]


All versions of silverstripe-simple-jobs with dependencies

PHP Build Version
Package Version
Requires php Version ^8
silverstripe/recipe-plugin Version ^2
silverstripe/vendor-plugin Version ^2
silverstripe/framework Version ^5
silverstripe/crontask Version ^3
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 lekoala/silverstripe-simple-jobs contains the following files

Loading the files please wait ....