PHP code example of carlosroberto555 / expressphp

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

    

carlosroberto555 / expressphp example snippets



 = new ExpressPHP\Express;

$app->use('/', function ($req, $res) {
  $res->send('Hello world!');
});


include 'vendor/autoload.php';

$app = new ExpressPHP\Express;

$app->use('/api', app::


// file /routes/api.php
$router = ExpressPHP\Express::Router();

// GET /api/users
$router->get('/users', function ($req, $res) {
  $res->json([
    ['name' => 'Libbie Dunn'],
    ['name' => 'Ella-Mai Davies'],
    ['name' => 'Elsie-Rose Dennis'],
    ['name' => 'Zena Slater'],
    ['name' => 'Antoni Partridge'],
  ]);
});



ExpressPHP\Express as app;

$app = new app;

$app->use('/hello', app::static('/static/index.html'));
// $app->use('/css', app::static('/static/css'));
// $app->use('/uploads', app::static('/static/images/uploads'));