Download the PHP package ct-imsglobal/lti-1p3-tool without Composer

On this page you can find all versions of the php package ct-imsglobal/lti-1p3-tool. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lti-1p3-tool

Note : If you are looking for the example tool that uses this library, it has been moved into its own repo https://github.com/IMSGlobal/lti-1-3-php-example-tool

LTI 1.3 Advantage Library

This code consists of a library for creating LTI tool providers in PHP.

Library Documentation

Importing the library

Using Composer

Add the following to your composer.json file

Run composer install or composer update In your code, you will now be able to use classes in the \IMSGlobal\LTI namespace to access the library.

Manually

To import the library, copy the lti folder inside src into your project and use the following code at the beginning of execution:

Accessing Registration Data

To allow for launches to be validated and to allow the tool to know where it has to make calls to, registration data must be stored. Rather than dictating how this is store, the library instead provides an interface that must be implemented to allow it to access registration data. The LTI\Database interface must be fully implemented for this to work.

The find_registration_by_issuer method must return an LTI\LTI_Registration.

The find_deployment method must return an LTI\LTI_Deployment if it exists within the database.

Calls into the Library will require an instance of LTI\Database to be passed into them.

Creating a JWKS endpoint

A JWKS (JSON Web Key Set) endpoint can be generated for either an individual registration or from an array of KIDs and private keys.

Handling Requests

Open Id Connect Login Request

LTI 1.3 uses a modified version of the OpenId Connect third party initiate login flow. This means that to do an LTI 1.3 launch, you must first receive a login initialization request and return to the platform.

To handle this request, you must first create a new LTI\LTI_OIDC_Login object.

Now you must configure your login request with a return url (this must be preconfigured and white-listed on the tool). If a redirect url is not given or the registration does not exist an LTI\OIDC_Exception will be thrown.

With the redirect, we can now redirect the user back to the tool. There are three ways to do this:

This will add a 302 location header and then exit.

This will echo out some javascript to do the redirect instead of using a 302.

You can also get the url you need to redirect to, with all the necessary query parameters, if you would prefer to redirect in a custom way.

Redirect is now done, we can move onto the launch.

LTI Message Launches

Now that we have done the OIDC log the platform will launch back to the tool. To handle this request, first we need to create a new LTI\LTI_Message_Launch object.

Once we have the message launch, we can validate it. This will check signatures and the presence of a deployment and any required parameters. If the validation fails an exception will be thrown.

Now we know the launch is valid we can find out more information about the launch.

Check if we have a resource launch or a deep linking launch.

Check which services we have access to.

Accessing Cached Launch Requests

It is likely that you will want to refer back to a launch later during subsequent requests. This is done using the launch id to identify a cached request. The launch id can be found using:

Once you have the launch id, you can link it to your session and pass it along as a query parameter.

Make sure you check the launch id against the user session to prevent someone from making actions on another person's launch.

Retrieving a launch using the launch id can be done using:

Once retrieved, you can call any of the methods on the launch object as normal, e.g.

Deep Linking Responses

If you receive a deep linking launch, it is very likely that you are going to want to respond to the deep linking request with resources for the platform.

To create a deep link response you will need to get the deep link for the current launch.

Now we are going to need to create LTI\LTI_Deep_Link_Resource to return.

Everything is set to return the resource to the platform. There are two methods of doing this.

The following method will output the html for an aut-posting form for you.

Alternatively you can just request the signed JWT that will need posting back to the platform by calling.

Calling Services

Names and Roles Service

Before using names and roles you should check that you have access to it.

Once we know we can access it, we can get an instance of the service from the launch.

From the service we can get an array of all the members by calling:

Assignments and Grades Service

Before using assignments and grades you should check that you have access to it.

Once we know we can access it, we can get an instance of the service from the launch.

To pass a grade back to the platform, you will need to create an LTI\LTI_Grade object and populate it with the necessary information.

To send the grade to the platform we can call:

This will put the grade into the default provided lineitem. If no default lineitem exists it will create one.

If you want to send multiple types of grade back, that can be done by specifying an LTI\LTI_Lineitem.

If a lineitem with the same tag exists, that lineitem will be used, otherwise a new lineitem will be created.

Contributing

If you have improvements, suggestions or bug fixes, feel free to make a pull request or issue and someone will take a look at it.

You do not need to be an IMS Member to use or contribute to this library, however it is recommended for better access to support resources and certification.

This library was initially created by @MartinLenord from Turnitin to help prove out the LTI 1.3 specification and accelerate tool development.

Note: This library is for IMS LTI 1.3 based specifications only. Requests to include custom, off-spec or vendor-specific changes will be declined.

Don't like PHP?

If you don't like PHP and have a favorite language that you would like to make a library for, we'd love to hear about it!


All versions of lti-1p3-tool with dependencies

PHP Build Version
Package Version
Requires firebase/php-jwt Version ^4.0 || >=4.0
phpseclib/phpseclib Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ct-imsglobal/lti-1p3-tool contains the following files

Loading the files please wait ....