Coder Social home page Coder Social logo

gkreitz / lti-1-3-php-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from packbackbooks/lti-1-3-php-library

0.0 0.0 0.0 762 KB

A library used for building IMS-certified LTI 1.3 tool providers in PHP.

License: Apache License 2.0

Shell 1.31% PHP 98.69%

lti-1-3-php-library's Introduction

LTI 1.3 Tool Library

Test status Maintainability Test Coverage

A library used for building IMS-certified LTI 1.3 tool providers in PHP.

This library allows a tool provider (your app) to receive LTI launches from a tool consumer (i.e. LMS). It validates LTI launches and lets an application interact with services like the Names Roles Provisioning Service (to fetch a roster for an LMS course) and Assignment Grades Service (to update grades for students in a course in the LMS).

This library was forked from IMSGlobal/lti-1-3-php-library, initially created by @MartinLenord. Packback found the library immensely helpful and extended it over the years. It has been rewritten by Packback to bring it into compliance with the standards set out by the PHP-FIG and the IMS LTI 1.3 Certification process. Packback actively uses and maintains this library.

Installation

Run:

composer require packbackbooks/lti-1p3-tool

In your code, you will now be able to use classes in the Packback\Lti1p3 namespace to access the library.

Configure JWT

Add the following when bootstrapping your app.

Firebase\JWT\JWT::$leeway = 5;

Implement Data Storage Interfaces

This library uses three methods for storing and accessing data: cache, cookie, and database. All three must be implemented in order for the library to work. You may create your own custom implementations so long as they adhere to the following interfaces:

  • Packback\Lti1p3\Interfaces\ICache
  • Packback\Lti1p3\Interfaces\ICookie
  • Packback\Lti1p3\Interfaces\IDatabase or optionally Packback\Lti1p3\Interfaces\IMigrationDatabase

View the Laravel Implementation Guide to see examples (or copy/paste the code outright).

Create 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.

use Packback\Lti1p3\JwksEndpoint;

// From issuer
JwksEndpoint::fromIssuer($database, 'http://example.com')->getPublicJwks();
// From registration
JwksEndpoint::fromRegistration($registration)->getPublicJwks();
// From array
JwksEndpoint::new(['a_unique_KID' => file_get_contents('/path/to/private/key.pem')])->getPublicJwks();

Documentation

The wiki provides more detailed information about how to use this library, including a Laravel Implementation Guide.

Contributing

For improvements, suggestions or bug fixes, make a pull request or an issue. Before opening a pull request, add automated tests for your changes, ensure that all tests pass, and any linting errors are fixed.

Testing

Automated tests can be run using the command:

composer test

Linting can be run using

# Display linting errors
composer lint
# Automatically fix linting errors
composer lint-fix

lti-1-3-php-library's People

Contributors

dbhynds avatar martinlenord avatar lin-brian-l avatar cophaso avatar pbcraig avatar pb-sobrien avatar zlayaavocado avatar janholger avatar erikdonohoo avatar erictendian avatar mattwright avatar jonahl avatar watercycle avatar snake avatar jlegault-packback avatar alessandrodolci avatar danieltiringer avatar dependabot[bot] avatar otterfan avatar dmitry-viskov avatar aramayiso avatar craigmbooth avatar danielzev avatar estevebadia avatar jonathangawrych avatar lmattson avatar matthieutran avatar meirzamoodle avatar pfgray avatar lokilein avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.