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\Commandment\Action as ActionInterface;
use DecodeLabs\Monarch;
use DecodeLabs\Pandora\Container;
use DecodeLabs\Veneer;
use MyThing;
use MyThing\Controller as MyThingController;
use MyThing\Action;
class Hub extends ClipHub
{
public function initializePlatform(): void
{
parent::initializePlatform();
// Load tasks from local namespace
Archetype::map(ActionInterface::class, Action::class);
// Create and load your controller (or use Generic)
if(Monarch::$container instanceof Container) {
$controller = new MyThingController();
Monarch::$container->bindShared(ControllerInterface::class, $controller);
Monarch::$container->bindShared(MyThingController::class, $controller);
}
}
}
namespace MyThing;
use DecodeLabs\Genesis\Bootstrap\Bin as BinBootstrap;
use MyThing\Hub;
namespace MyThing\Action;
use DecodeLabs\Commandment\Action;
use DecodeLabs\Commandment\Request;
class MyAction implements Action
{
public function execute(
Request $request
): bool {
// Do the thing
return true;
}
}
use DecodeLabs\Terminus as Cli;
Cli::writeLine('Hello world');
namespace MyThing\Action;
use DecodeLabs\Commandment\Action;
use DecodeLabs\Commandment\Request;
use DecodeLabs\Terminus\Session;
class MyAction implements Action
{
public function __construct(
private Session $io
) {
}
public function execute(
Request $request
): bool {
$this->io->writeLine('Hello world');
return true;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.