PHP code example of clearbooks / dilex

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

    

clearbooks / dilex example snippets


$environment = 'dev';
$debug = true;
$container = new DependencyInjectionContainer(); // replace with your real DI initialisation code
$application = new \Clearbooks\Dilex\Dilex( $environment, $debug, $container );

namespace Your\Organisation\Endpoint;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Clearbooks\Dilex\Endpoint;

class ExampleEndpoint implements Endpoint
{
    public function execute( Request $request )
    {
        return new JsonResponse( ['hello' => 'world'] );
    }
}


use Your\Organisation\Endpoint\ExampleEndpoint;
/*
 * Initialisation code above skipped
 */
$application->get( '/', ExampleEndpoint::class );