PHP code example of decodelabs / clip

1. Go to this page and download the library: Download decodelabs/clip 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/ */

    

decodelabs / clip example snippets


namespace MyThing;

use DecodeLabs\Archetype;
use DecodeLabs\Clip\Controller as ControllerInterface;
use DecodeLabs\Clip\Hub as ClipHub;
use DecodeLabs\Clip\Task as TaskInterface;
use DecodeLabs\Veneer;
use MyThing;
use MyThing\Controller;
use MyThing\Task;

class Hub extends ClipHub
{
    public function initializePlatform(): void
    {
        parent::initializePlatform();

        // Load tasks from local namespace
        Archetype::map(TaskInterface::class, Task::class);

        // Create and load your controller (or use Generic)
        $controller = new Controller();
        $this->context->container->bindShared(ControllerInterface::class, $controller);
        $this->context->container->bindShared(Controller::class, $controller);

        // Bind your controller with Veneer
        Veneer::register(Controller::class, MyThing::class);
    }
}

namespace MyThing;

use DecodeLabs\Genesis;
use MyThing\Hub;


namespace MyThing\Task;

use DecodeLabs\Clip\Task;

class MyTask implements Task
{
    public function execute(): bool
    {
        // Do the thing
        return true;
    }
}