rockschtar/wordpress-cronjob

Library for use with roots/bedrock based WordPress projects. Simplifys the creation of WordPress cronjobs.

1.0.0 2020-05-26 08:04 UTC

This package is auto-updated.

Last update: 2024-12-17 21:11:35 UTC


README

Description

Library for use with roots/bedrock based WordPress projects. Simplifys the creation of WordPress cronjobs.

Requirements

License

rockschtar/wordpress-cronjob is open source and released under MIT license. See LICENSE.md file for more info.

Usage

Create a cronjob class

class TestCronjob extends AbstractCronjob {

    public function execute(): void {
        //do some stuff
    }

    public function config(): CronjobConfig {
        $config = new CronjobConfig();
        $config->setHook('do_test_cronjob');
        $config->setPluginFile('some_plugin.php');
        $config->setFirstRun(new \DateTime());
        $config->setRecurrence('daily');
        return $config;
    }
}

Initialize the class

TestCronjob::init();

Question? Issues?

rockschtar/wordpress-cronjob is hosted on GitLab. Feel free to open issues there for suggestions, questions and real issues.