PHP code example of jeyroik / extas-api

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

    

jeyroik / extas-api example snippets


use extas\components\plugins\Plugin;
use extas\interfaces\stages\IStageApiAppInit;
use Slim\App;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

class PluginOwnRoute extends Plugin implements IStageApiAppInit
{
    /**
     * @param App $app
     */
    public function __invoke(App &$app): void
    {
        $app->post(// post/get/delete/put/patch/any/
            '/my/route',
            function (RequestInterface $request, ResponseInterface $response, array $args) {
                // dispatching 
            }
        );
    }
}


namespace some\routes;

use extas\components\routes\dispatchers\JsonDispatcher;

class ClassName extends JsonDispatcher
{
    use TRouteList;

    protected string $repoName = 'my_items';

    public function help(): ResponseInterface
    {
        //...
    }
}


namespace my\interfaces;

class IMyItem
{
    //...
}