This package is aimed to be a simplistic PHP workflow package that works in a similar fashion to GitHub Actions.

Overview

Workflow

Tests

This package is aimed to be a simplistic PHP workflow package that works in a similar fashion to GitHub Actions.

Installation

To install this package, use the following composer command:

composer require juststeveking/workflow

Usage

To create a new Workflow Runner, all you need to do is build it. It will take an optional array of Workflows for you to pass in, or you can allow it to default to empty to programatically build it yourself.

Building a Workflow Runner without Workflows

use JustSteveKing\Workflow\WorkflowRunner;

$runner = WorkflowRunner::build();

Building a Workflow Runner with a Workflow

use JustSteveKing\Workflow\WorkflowRunner;

$runner = WorkflowRunner::build(
    workflows: [
        WorkflowBuilder::make(
            payload: JsonLoader::load(__DIR__ . '/path/to/workflow.json')
        )
    ]
);

Building a Workflow

To build a workflow you can use either a YAML file or a JSON file:

Example YAML Workflow File

name: 'test'

jobs:
  test:
    run:
      target: JustSteveKing\Workflow\Stubs\Test
      method: run
      args:
        - 'test'
        - 10
        - true

  another:
    run:
      target: JustSteveKing\Workflow\Stubs\Test
      method: another
      args:
        - 'test'

Example JSON Workflow File

{
  "name": "test",
  "jobs": {
    "test": {
      "run": {
        "target": "JustSteveKing\\Workflow\\Stubs\\Test",
        "method": "run",
        "args": [
          "test",
          10,
          true
        ]
      }
    },
    "another": {
      "run": {
        "target": "JustSteveKing\\Workflow\\Stubs\\Test",
        "method": "another",
        "args": [
          "test"
        ]
      }
    }
  }
}

You can pass these files into a WorkflowBuilder using the following approaches:

JSON Workflow

use JustSteveKing\Workflow\WorkflowBuilder;
use JustSteveKing\Workflow\Loaders\JsonLoader;

$workflow = WorkflowBuilder::make(
    payload: JsonLoader::load(__DIR__ . '/path/to/workflow.json')
);

YAML Workflow

use JustSteveKing\Workflow\WorkflowBuilder;
use JustSteveKing\Workflow\Loaders\YamlLoader;

$workflow = WorkflowBuilder::make(
    payload: YamlLoader::load(__DIR__ . '/path/to/workflow.yaml')
);

Running a workflow

Once you have built up your Workflow runner - all you need to do is run it:

use JustSteveKing\Workflow\WorkflowRunner;

$runner = WorkflowRunner::build(
    workflows: [
        WorkflowBuilder::make(
            payload: JsonLoader::load(__DIR__ . '/path/to/workflow.json')
        )
    ]
);

$runner->run();

Each Job for each workflow anythings returned will be added to an internal log on the runner allowing you to check that they ran. This can be accessed using:

$runner->logs();
You might also like...
Get the system resources in PHP, as memory, number of CPU'S, Temperature of CPU or GPU, Operating System, Hard Disk usage, .... Works in Windows & Linux

system-resources. A class to get the hardware resources We can get CPU load, CPU/GPU temperature, free/used memory & Hard disk. Written in PHP It is a

This is a plugin written in PHP programming language and running on the PocketMine platform that works stably on the API 3.25.0 platform

This is a plugin written in PHP programming language and running on the PocketMine platform that works stably on the API 3.25.0 platform. It allows you to hear the sound

nUberSoft is a small in-the-works framework Library for PHP

nUberSoft is a small in-the-works framework Library for PHP. It is a mix of old and new due to it's long development timeframe. Documentation is not as robust as it should be. The majority of this framework will work for non-Linux-based systems, but it is not tested and some security (.htaccess) are not read by Win servers.

A payment gateway plugin for WooCommerce to see if your checkout works.

=== Order Test For All for WooCommerce === Contributors: ikamal Donate link: https://kamal.pw/ Tags: wc order test, wc order, woocommerce, woocommerce

Much improved replacement for Zend_Cache_Backend_File - works great with Magento!

Cm_Cache_Backend_File The stock Zend_Cache_Backend_File backend has extremely poor performance for cleaning by tags making it become unusable as the n

A Zend_Cache backend for Redis with full support for tags (works great with Magento)

Zend_Cache backend using Redis with full support for tags This Zend_Cache backend allows you to use a Redis server as a central cache storage. Tags ar

Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

🔒 Built a recaptcha for Nifty that works with Wordpress's Gravity Forms
🔒 Built a recaptcha for Nifty that works with Wordpress's Gravity Forms

Recaptcha Fully Functioning spam filter that has 10 levels of security, but is slim and rpackaged to integrate with any Gravity Forms form WORKING EXA

Naive Bayes works by looking at a training set and making a guess based on that set.

Naive Bayes Naive Bayes works by looking at a training set and making a guess based on that set. It uses simple statistics and a bit of math to calcul

Releases(0.0.1)
Owner
Steve McDougall
Engineering at @JumpTwentyFour | Streaming at https://www.youtube.com/c/JustSteveKing | Blogging at https://www.juststeveking.uk/
Steve McDougall
A Simplistic Plugin to Implement Server Claims to your Minecraft: Bedrock Server.

Claims This plugin allows administrators to create, edit, list, and teleport to land claims on a PocketMine server. These claims have a variety of cus

Santana 5 Jun 10, 2023
A Twitter bot powered by Github Actions tweeing Wikidata milestones

Twitter WikidataMeter Bot I'm the code, and deployment of Twitter bot WikidataMeter. I tweet a few fun things about Wikidata as it grows. Tweets Feel

null 9 Dec 9, 2022
GitHub Actions for Magento 2 Extensions

GitHub Actions for Magento 2 Extensions This repository's aim is to provide a set of open sourced GitHub actions to write better tested Magento 2 exte

ExtDN 104 Jan 1, 2023
The tool converts different error reporting standards for deep compatibility with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc).

JBZoo / CI-Report-Converter Why? Installing Using as GitHub Action Example GitHub Action workflow Available Directions Help description in terminal Co

JBZoo Toolbox 17 Jun 16, 2022
This repository aims to build a fairly complete CI/CD example using GitHub workflows and actions.

CI/CD example This repository aims to build a fairly complete CI/CD example using GitHub workflows and actions. Keep in mind that the toolset used in

Robin Ingelbrecht 4 Nov 1, 2022
Zephir is a compiled high level language aimed to the creation of C-extensions for PHP.

Zephir - is a high level programming language that eases the creation and maintainability of extensions for PHP. Zephir extensions are exported to C c

Zephir Language 3.2k Jan 2, 2023
Run your WP site on github pages, php innovation award winner https://www.phpclasses.org/package/12091-PHP-Make-a-WordPress-site-run-on-GitHub-pages.html

Gitpress Run wordpress directly on github pages Gitpress won the innovation award for may 2021 Read more about this https://naveen17797.github.io/gitp

naveen 13 Nov 18, 2022
MajorDoMo is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment.

MajorDoMo (Major Domestic Module) is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment. It is based on web-technologies stack and ready to be delivered to any modern device. It is very flexible in configuration with OOP paradigm used to set up automation rules and scripts. This platform can be installed on almost any personal computer running Windows or Linux OS.

Sergei Jeihala 369 Dec 30, 2022
Webman quickly creates a verification code tool similar to Google verification code

webman-captcha-grid webman quickly creates a verification code tool similar to Google verification code webman 快速创建一个类似于 Google 点图验证码的本地验证码扩展 介绍 webma

听风吹雨 6 Dec 5, 2022
Actions: controller + auth + validation in one class

Actions: controller + auth + validation in one class This package provides only one class: an Action class that extends the FormRequest class we all k

edatta 2 Dec 15, 2022