PHP code example of jasonmichels / groundworkphp

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

    

jasonmichels / groundworkphp example snippets


declare(strict_types=1);
work\App;
use GroundworkPHP\Framework\Http\Router;
use Symfony\Component\HttpFoundation\JsonResponse;

$httpMethod = $_SERVER['REQUEST_METHOD'];
$uri = rawurldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

$app = new App($uri, $httpMethod, new Router());

$app->get('/', function (JsonResponse $response) {
    $response->setData(['data' => ['stuff' => 'awesome']]);
    return $response;
});

$app->run();