PHP code example of mohammadraufzahed / tondbad-swoole

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

    

mohammadraufzahed / tondbad-swoole example snippets


namespace App\Controllers;

use TondbadSwoole\Core\Route\Attributes\Endpoint;
use OpenSwoole\Http\Request;
use OpenSwoole\Http\Response;

class HomeController
{
    #[Endpoint('GET', '/')]
    public function index(Request $request, Response $response)
    {
        $response->end('Welcome to TondbadSwoole!');
    }

    #[Endpoint('POST', '/submit')]
    public function submit(Request $request, Response $response)
    {
        $response->end('Form Submitted!');
    }
}

return [
    \App\Controllers\HomeController::class,
    \App\Controllers\UserController::class,
];