PHP code example of alex-lee / fastswoole

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

    

alex-lee / fastswoole example snippets



namespace App\index\controller;

use App\exception\SystemException;
use Fastswoole\core\Controller;

class Index extends Controller
{
    public function index()
    {
        $this->app->html('<h1>Hello Swoole.</h1>');
    }

    public function hello()
    {
        $this->app->json(['hello' => 'fastswoole']);
    }

    public function systemError()
    {
        SystemException::throwException(SystemException::SYSTEM_ERROR);
    }