PHP code example of expressif / http

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

    

expressif / http example snippets




  pressif\Http\Server;

  $endpoint = '127.0.0.1:1337';
  echo "Serving HTTP at http://$endpoint\n";

  $http = new Server('tcp://' . $endpoint);

  $http->on('request', function($req, $res) {
    $res->writeHead(200, ['Content-Type' => 'text/plain']);
    $res->end('Hello world');
  });