PHP code example of firstphp / wsdebug

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

    

firstphp / wsdebug example snippets


Router::addRoute(['GET', 'POST', 'HEAD'], '/wsdebug', function() {
    $wsdebug = new \Firstphp\Wsdebug\Wsdebug();
    $response = new \Hyperf\HttpServer\Response();
    return $response->raw($wsdebug->getHtml())->withHeader('content-type', 'text/html; charset=utf-8');
});

Router::addServer('ws', function () {
    Router::get('/', Firstphp\Wsdebug\Wsdebug::class);
});


namespace App\HttpController;

use Hyperf\Di\Annotation\Inject;
use Firstphp\Wsdebug\Wsdebug;

class TestController 
{
   /**
    * @Inject()
    * @var Wsdebug
    */
	protected $debug;

	public function test()
	{
		$userData = [
		    'uid' => 1,
		    'username' => 'wsdebug',
		];
		$this->debug->send($userData);
	}
}