PHP code example of gabrieljmj / silex-server

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

    

gabrieljmj / silex-server example snippets


# index.php


ljmj\SilexServer\Application();

$app->get('/hello/{name}', function ($name) use ($app) {
  return 'Hello '.$app->escape($name);
});

$app->run();

return $app; // This MUST be in the file

#!/usr/bin/env php

$app = 000;

$app->createServer($host, $port, function () use ($port) {
    echo "Running on port {$port}\n";
})->run();