PHP code example of stylers / laravel-task-manager
1. Go to this page and download the library: Download stylers/laravel-task-manager 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/ */
stylers / laravel-task-manager example snippets
use Illuminate\Console\Command;
use Stylers\TaskManager\Contracts\TaskTimerInterface;
use Stylers\TaskManager\Traits\TaskTimer;
class CommandTask extends Command implements TaskTimerInterface
{
use TaskTimer;
public function handle()
{
//
}
}
use Illuminate\Support\ServiceProvider;
use Stylers\TaskManager\Console\TaskManager;
use Stylers\TaskManager\Tests\Fixtures\CommandTask;
class ScheduleServiceProvider extends ServiceProvider
{
public function boot()
{
parent::boot();
$this->app->booted(function () {
$scheduler = app(TaskManager::class);
// Single task adding
$scheduler->addTasks(
(new CommandTask())->dailyAt('6:00')
);
// ---- OR ----
// Multiple task adding in same time
$scheduler->bulkAddTasks([
(new CommandTask())->dailyAt('6:00'),
(new CommandTask())->weekly(),
]);
});
}
}
use Stylers\TaskManager\Console\TaskManager;
use Illuminate\Support\Facades\Route;
Route::get('/cron', static function () {
TaskManager::run();
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.