PHP code example of imefisto / swoole-psr-kit

1. Go to this page and download the library: Download imefisto/swoole-psr-kit 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/ */

    

imefisto / swoole-psr-kit example snippets


return [
    // some configuration
]

use Http\Factory\Guzzle\ResponseFactory;
use Http\Factory\Guzzle\StreamFactory;
use Http\Factory\Guzzle\UploadedFileFactory;
use Http\Factory\Guzzle\UriFactory;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UploadedFileFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;

return [
    ResponseFactoryInterface::class => \DI\get(ResponseFactory::class),
    StreamFactoryInterface::class => \DI\get(StreamFactory::class),
    UploadedFileFactoryInterface::class => \DI\get(UploadedFileFactory::class),
    UriFactoryInterface::class => \DI\get(UriFactory::class),
];

use Imefisto\SwooleKit\Presentation\Controller\Example;

return [
    ['GET', '/example', Example::class, 'getExample'],
];

use Imefisto\SwooleKit\Infrastructure\DependencyInjection\ContainerFactory;
use Imefisto\SwooleKit\Infrastructure\Routing\Router;
use Imefisto\SwooleKit\Infrastructure\Swoole\Server;

encies, $routes);

$server = $container->get(Server::class);
$server->run();