PHP code example of jonbaldie / eleven

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

    

jonbaldie / eleven example snippets




use Eleven\App;

/0.0.0.0:3000');

$api->count = 4; // process count

$api->any('/', function ($request) {
    return 'Hello world';
});

$api->get('/hello/{name}', function ($request, $name) {
    return "Hello $name";
});

$api->post('/user/create', function ($request) {
    return json_encode(['code' => 200 ,'message' => 'OKAY'], JSON_PRETTY_PRINT);
});

$api->start();

# To restart the worker threads:
php start.php restart -d

# To stop the worker threads:
php start.php stop

# To get a pretty status table:
php start.php status

# To see a list of active connections:
php start.php connections