1. Go to this page and download the library: Download mariojgt/witchcraft library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mariojgt / witchcraft example snippets
namespace App\Witchcraft\Handlers;
use Mariojgt\Witchcraft\Contracts\NodeHandlerInterface;
class ProcessOrderNodeHandler implements NodeHandlerInterface
{
public function getMetadata(): array
{
return [
'type' => 'process-order',
'category' => 'Custom',
// Use either a Lucide icon name
'icon' => 'BoxIcon',
// Or a custom SVG string
'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">...</svg>',
'label' => 'Process Order',
'component' => 'ProcessOrderNode',
'initialData' => [
'outputKey' => 'customOutput',
'example' => 'value'
]
];
}
}
use Mariojgt\Witchcraft\Traits\HasWitchcraftTriggers;
class User extends Model
{
use HasWitchcraftTriggers;
// Your model code
}
use Mariojgt\Witchcraft\Services\WitchcraftTrigger;
// Execute a workflow
WitchcraftTrigger::execute(8, ['status' => 'active']);