Download the PHP package doiftrue/wp-kama-cron without Composer

On this page you can find all versions of the php package doiftrue/wp-kama-cron. 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 wp-kama-cron

A small class for easily adding WP-Cron tasks (jobs).

This class allows you to create WordPress cron tasks quickly and simply. To avoid confusion, all task settings are specified in the first argument when creating the class instance. The class handles all the routine work required to properly register cron tasks and their intervals. The task handler (callback function) must already exist in PHP or be written separately.

Requirements

Examples

By default, tasks are registered automatically (very fast) when you visit the admin panel, during a WP-CLI request, or during any cron request. If automatic registration is not needed, set the parameter 'auto_activate' => false and activate tasks manually using the activate() method. See the example below.

INFO: You can call Kama_Cron at an early stage of WordPress loading, starting from the muplugins_loaded hook.

IMPORTANT: The Kama_Cron code must also run during cron requests, because it registers the required WP hooks that are executed in those requests. In other words, you cannot register a cron job with this code and then remove this code.

Repeatable job

Use the known WP interval (hourly):

wpkama_core_data_check_update is the internal name of the WP hook. You do not need to use it anywhere else in your code. Just specify a unique and understandable name (it is a good idea to use the same name as the callback function).

Use the unknown WP interval (10 minutes):

In this case, the class will parse the string 10 minutes and fill in the interval_sec and interval_desc parameters automatically.

In interval_name, you can specify a value in the following format: N (min|minutes|hour|day|month)s (for example: 10 minutes, 2 hours, 5 days, 2 months). The numeric value will be used for the interval_sec parameter. You can also specify an existing WP interval: hourly, twicedaily, daily.

Single job

Single job (once):

Single job at a specific time:

IMPORTANT: For single jobs, start_time must be a future timestamp. If it is in the past, the event will not be scheduled.

Pass arguments to callback

Access an instance by ID

NOTE: If the ID is not found, Kama_Cron::get() returns an empty stub instance.

Register more than one task at once

Let's create 4 tasks with different intervals. Tasks are registered automatically (very fast) when you visit the admin panel, via CLI, or during a cron request.

Add the following code anywhere, for example in functions.php or in a plugin.

Register tasks when activating the plugin

The code below shows how to activate and deactivate tasks manually during plugin activation/deactivation.

IMPORTANT: in this case, the auto_activate parameter must be set to false: 'auto_activate' => false.

INFO: The deactivate() method will deactivate all jobs from the current pack (in the example above, there are two jobs).

--

Plugin page: https://wp-kama.com/1353/kama_cron


All versions of wp-kama-cron with dependencies

PHP Build Version
Package Version
No informations.
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 doiftrue/wp-kama-cron contains the following files

Loading the files please wait ...