PHP code example of palabs / endpoint-bundle

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

    

palabs / endpoint-bundle example snippets


// app/AppKernel.php

public function registerBundles()
{
    return [
        // ...
        new PaLabs\EndpointBundle\PaEndpointBundle(),
        // ...
    ];
}

use PaLabs\EndpointBundle\EndpointInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class TextEndpoint implements EndpointInterface {

    public function routes()
    {
       return new Route('/cool_message');
    }
    
    
    public function execute(Request $request): Response
    {
       return new Response('Hello, world');
    }
}