skyline / cli
This package makes a Skyline Web Application accessible via command line, for example to trigger background tasks from a foreign target.
Requires
- php: ^7|^8
- skyline/kernel: ^0.8|^8|^0.9
Requires (Dev)
- phpunit/phpunit: ^9
- skyline/compiler: ^0.8|^8
This package is auto-updated.
Last update: 2024-12-07 23:55:36 UTC
README
The CLI Package adds a plugin to your application that interact on command line requests.
By default, the file ~/Public/skyline.php
gets called by apache or another webserver to deliver your webpage.
If this file gets performed under command line, you will get an error, because the routing never will success.
This Package installed it will listen for command line calls and forward to registered tasks.
Installation
$ composer require skyline/cli
Usage
The package introduces a new configuration file:
processes.cfg.php
All files with this name are collected while compiling and they should declare a process info.
Such a config file might look like:
<?php // File MyClass.php class MyClass { // Constructor must not expect arguments. // If you need so, specify as service and define with ProcessConfig::PROCESS_SERVICE_NAME public function __construct() {} public function run($argc, $argv) { // Do stuff } } // File: processes.cfg.php use Skyline\CLI\Config\ProcessConfig; return [ [ ProcessConfig::PROCESS_NAME => 'my-process', ProcessConfig::PROCESS_METHOD => 'run', ProcessConfig::PROCESS_CLASS_NAME => stdClass::class ] ];