PHP code example of kozo / mechanical

1. Go to this page and download the library: Download kozo/mechanical library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kozo / mechanical example snippets


php bin/cake.php mechanical create

// sample


namespace App\Mechanical;

use Watchmaker\Watchmaker;

class MechanicalCron {

    public function handle(Watchmaker $watchmaker): Watchmaker
    {
        $i = $watchmaker->task('php hoge/fuga.php');
        $i = $i
            ->month(1)
            ->day(5);
        $watchmaker->add($i);

        $j = $watchmaker->task('php hoge/hoge.php');
        $j = $j
            ->month(2)
            ->day(6);
        $watchmaker->add($j);

        return $watchmaker;
    }
}

php bin/cake.php mechanical show

php bin/cake.php mechanical install