tearsilent/laravel-scheduler

Laravel schedule jobs handler

dev-main 2022-08-11 10:08 UTC

This package is auto-updated.

Last update: 2024-09-11 14:42:58 UTC


README

Packagist Packagist Build Status StyleCI Packagist

Installation - Basic

  1. Install the package using composer:
composer require tearsilent/laravel-scheduler
  1. Run the migration to install the package's table to record visits to by executing:
php artisan migrate
  1. Publish the config file, assets, and views by running:
php artisan vendor:publish

Since fetching data from an external API takes time, the operation is queued an performed asynchronously. This is done using Laravel Jobs and probably won't work on a shared hosting. There are multiple drivers supported. We'll describe how to set up the database driver.

First, in your .env file you need to set:

QUEUE_DRIVER=database

Then run these commands one after another:

php artisan queue:table
php artisan queue:failed-table
php artisan migrate

Finally, you need to start the worker that will take care of the queue. Run the following command and keep it running:

php artisan queue:work

Read more on Queues and Jobs in the Laravel documentation. This section describes how to restart the queue worker automatically in case the process fails.

P.S. You need to restart the worker every time you've made changes to the package's config file.

License

This is open-sourced software licensed under the MIT license.