PHP code example of ekino / drupal-bundle

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

    

ekino / drupal-bundle example snippets

 php

nce __DIR__.'/../app/AppKernel.php';
//use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('dev', true); //
$kernel->loadClassCache();
$kernel->boot();

// make the Symfony container available from Drupal file
global $container;

$container = $kernel->getContainer();

$request = Request::createFromGlobals();

$response = $kernel->handle($request);
$response->send();

$kernel->terminate($request, $response);
 php

function drupal_foo_function() {
    $result = symfony_service('reusage_service')->foo();

    // do some stuff with $result
}