chevere/workflow

Async workflow procedures for PHP

0.7.1 2022-12-21 10:20 UTC

This package is auto-updated.

Last update: 2023-03-21 22:11:25 UTC


README

🔔 Subscribe to the newsletter to don't miss any update regarding Chevere.

Chevere

Build Code size Apache-2.0 PHPStan Mutation testing badge

Quality Gate Status Maintainability Rating Reliability Rating Security Rating Coverage Technical Debt CodeFactor Codacy Badge

Workflow

Quick start

Install with Composer.

composer install chevere/workflow

Create a Workflow by passing named jobs.

  • async for asynchronous non-blocking jobs
  • sync for synchronous blocking jobs
  • variable for defining a variable
  • reference to define a reference to a previous job
use function Chevere\Workflow\workflow;
use function Chevere\Workflow\sync;
use function Chevere\Workflow\async;
use function Chevere\Workflow\variable;

$workflow = workflow(
    thumb: async(
        new ImageResize(),
        file: variable('file'),
        fit: 'thumbnail',
    ),
    poster: async(
        new ImageResize(),
        file: variable('file'),
        fit: 'poster',
    ),
    store: sync(
        new StoreFiles(),
        reference('thumb', 'out'),
        reference('poster', 'out'),
    )
);

Run your Workflow:

use function Chevere\Workflow\run;

$variables = [
    'file' => '/path/to/file'
];
$run = run($workflow, $variables);

Variable $run will be assigned to an object implementing RunInterface, which you can query for obtaining data from the Workflow runtime.

Documentation

Documentation is available at chevere.org.

License

Copyright 2022 Rodolfo Berrios A.

This software is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.