Download the PHP package dades/scheduledtask without Composer

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

Dades\ScheduledTaskBundle

A Symfony Bundle that schedule tasks and commands on Windows and Linux.
It uses the cron system from Linux on both operating systems.

Installation

  1. Run the following command to add the bundle to your project as a composer dependency:
    composer require dades/scheduledtask

  2. Add the bundle to your application kernel:

  3. If you didn't create your database before, run php bin/console doctrine:database:create

  4. Then you have to create the table that will store your scheduled tasks:
    php bin/console doctrine:schema:update --force

Windows OS

  1. You have to tell to your system to check every minute if a task should be run. To do that, run the following command on your cmd:
    schtasks /CREATE /TN "uniqueName" /TR "php D:\path\to\your\project\bin\console cron:run" /SC minute

Make sure that schtasks is globally install on your system.

Linux OS

  1. You have to tell to your system to check every minute if a task should be run. To do that, you have to add a cronjob in your crontab:

    1. run crontab -e to edit your crontab

    2. add * * * * * php /path/to/your/project/bin/console cron:run >> ~/tmp 2>&1 in the file

How it works

Now you're ready to create all the scheduled tasks you want. You just need to handle these 2 classes:
Dades\ScheduledTaskBundle\Entity\ScheduledTask
Dades\ScheduledTaskBundle\Service\ScheduledTaskService

Inject the service that handles ScheduledTask class:

Note that this is a Service, so you can inject it anywhere you want.

Create a scheduled task

Once your Service is injected, you can do the following thing:

In this example, the "php --version" command will be run every minute.

Get one or more scheduled tasks

You can get a task by its id or get all tasks in an array. Example:

Update a scheduled task

To update a task, just set the value that you want to change and call the ScheduledTaskService:

Delete a task

You have to get the task that you want to remove and call the delete method:

Where the magic happens

Now you know how to install, setup and handle scheduled tasks, but you don't know yet where they are executed.
Just have a look in the Dades\ScheduledTaskBundle\Command\RunCronCommand class.

These 2 lines to the trick.
The first line check if the task $task must be run now.
The second line execute the command.

More informations

The stdout and stderr streams are logged in the var/logs/dades_scheduled_task_bundle.log.
Thanks to this file, you have a trace of all your task executions.
If the file doesn't exist, don't worry, it will be automatically created.

This bundle use the dragonmantank/cron-expression library.
This lib read the cron expression of each task to determine if this task should be run now.
I invite you to read more about this here.


All versions of scheduledtask with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
symfony/framework-bundle Version ^3.4
doctrine/doctrine-bundle Version ^1.3
symfony/console Version ^2.8 || ^3.0 || ^4.0
dragonmantank/cron-expression Version ^2.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 dades/scheduledtask contains the following files

Loading the files please wait ....