PHP code example of milpa / http-symfony

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

    

milpa / http-symfony example snippets


use Milpa\Http\HttpMethod;
use Milpa\Http\Routing\Route;
use Milpa\Http\Symfony\BaseController;
use Milpa\Http\Symfony\HttpResponse;
use Symfony\Component\HttpFoundation\Request;

final class HealthController extends BaseController
{
    #[Route(path: '/health', methods: HttpMethod::GET, name: 'health')]
    public function show(Request $request, array $params = []): HttpResponse
    {
        return $this->json(['status' => 'ok']);
    }
}