This bundle is a consumer setup for the LTI protocol

v4.4.0 2021-06-17 12:18 UTC

This package is auto-updated.

Last update: 2024-06-04 14:22:25 UTC


This bundle can be used to establish LTI (version 1) connections to an e-learning tool provider.

How to install?

Install the bundle via composer

composer require intracto/lti-consumer-bundle

Enable the bundle

// app/AppKernel.php

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

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

        // ...


        path:     /lti/launch
        defaults: { _controller: intracto.lti.controller:launchAction }

How to get started?

Fill in parameters.yml

# allows you to send custom parameters to the launch action and include them with the LTI request.
    aCustomParameterName: ltiFieldName
        url: 'launch-url-toolprovider-connect'
        base_url: 'base-url-toolprovider-connect'
        key: key-provided-by-tool-provider
        secret: secret-provided-by-tool-provder
        lti_version: LTI-1p0
        resource_link_id: ToolProvider
        resource_link_title: ToolProvider
        tool_consumer_info_version: '1.1'
        tool_consumer_instance_guid: your-instance-guid
        tool_consumer_instance_description: your-instance-name

Create action in Controller

public function openElearningAction($elearningId)

    return $this->render(
            'tool_url' => $this->generateUrl(
                    'email' => $this->getUser()->getUsername(),
                    'aCustomParameterName' => $elearningId,  // $elearningId will be sent with the LTI connection as 'ltiFieldName' because of intracto_lti.custom_parameters

Create a template 'e_learning.html.twig'

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
<header class="e-learning">
    <h1 class="e-learning__title">{{ 'e_learning.page_title'|trans }}</h1>
<iframe class="page" src="{{ tool_url }}" width="100%" height="100%" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

Create a template 'app/Resources/LTIConsumerBundle/views/index.html.twig'

This template will be used by the bundle to do the connect-request and to load the LTI provider into an iframe in your application

{{ form(form,{'attr': {'id': 'lti_form'}}) }}
<p>{{ 'lti.launch.message'|trans }}</p>
<script src=""></script>
    (function($) {