PHP code example of intracto / lti-consumer-bundle

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

    

intracto / lti-consumer-bundle example snippets


// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = array(
            // ...,
            new Intracto\LTIConsumerBundle\LTIConsumerBundle(),
        );

        // ...
    }
}

public function openElearningAction($elearningId)
{

    return $this->render(
        '@App/Elearning/e_learning.html.twig',
        [
            'tool_url' => $this->generateUrl(
                'intracto_lti_consumer_launch',
                [
                    'email' => $this->getUser()->getUsername(),
                    'aCustomParameterName' => $elearningId,  // $elearningId will be sent with the LTI connection as 'ltiFieldName' because of intracto_lti.custom_parameters
                ]
            )
        ]
    );
}