1. Go to this page and download the library: Download antidot-fw/tactician 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/ */
namespace App\Handler;
use App\Command\PingCommand;
class PingHandler
{
public function __invoke(PingCommand $command)
{
return time();
}
}
namespace App\Action;
use App\Command\PingCommand;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
class PingAction implements RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface
{
return new JsonResponse(['ack' => $this->bus->handle(new PingCommand())]);
}
}