kapersoft/knocker-for-laravel

This is my package knocker-for-laravel

v1.0.1 2025-05-24 18:05 UTC

This package is auto-updated.

Last update: 2025-05-24 18:08:45 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package that seamlessly integrates your application with Knocker for Laravel Cloud - a reliable service that ensures your scheduled tasks continue running even when your Laravel application is in hibernation mode.

Learn more about Knocker for Laravel Cloud at https://knocker.laravel.cloud.

Requirements

  • PHP 8.3 or higher
  • Laravel 12.0 or higher

Installation

Install the package using Composer:

composer require kapersoft/knocker-for-laravel

Publish configuration file

If you like, you can publish the configuration file:

php artisan vendor:publish --tag="knocker-for-laravel-config"

This will create a configuration file with the following structure:

return [
    'endpoint' => env('KNOCKER_ENDPOINT', 'https://knocker.laravel.cloud/api/v1/schedulerTasks'),
    'token' => env('KNOCKER_TOKEN', ''),
];

Configuration

After registering your application on Knocker for Laravel Cloud, add your authentication token to the .env file:

KNOCKER_TOKEN=your-knocker-token-here

Usage

Registering Scheduled Tasks

To register your application's scheduled tasks with Knocker for Laravel Cloud, run the following command:

php artisan knocker:send-scheduler-tasks

This command performs the following actions:

  1. Scans your scheduled tasks. These are usually in routes/console.php or app/Console/Kernel.php
  2. Extracts task configurations including:
    • Cron expressions and timing
    • Command names and descriptions
    • Timezone settings
    • Callback functions and closures
  3. Uploads the task information to Knocker for Laravel Cloud

Deployment Integration

For seamless integration, add the registration command to your deployment pipeline:

php artisan knocker:send-scheduler-tasks

This ensures your task configurations are automatically updated with each deployment, keeping Knocker for Laravel Cloud synchronized with your latest scheduled tasks.

Testing

Run the test suite:

composer test

Documentation

Please see the following files for additional information:

Security

Please review our security policy for information on reporting security vulnerabilities.

Credits

License

This package is open-sourced software licensed under the MIT License.