packbackbooks / lti-1p3-tool
A library used for building IMS-certified LTI 1.3 tool providers in PHP.
Installs: 284 651
Dependents: 0
Suggesters: 0
Security: 0
Stars: 39
Watchers: 6
Forks: 105
Open Issues: 9
Requires
- php: ^8.1
- firebase/php-jwt: ^6.6
- guzzlehttp/guzzle: ^7.0
- phpseclib/phpseclib: ^3.0
Requires (Dev)
- laravel/pint: ^1.0
- mockery/mockery: ^1.4
- nesbot/carbon: ^2.43 || ^3.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.0|^10.0
- dev-master
- v6.2.0
- v6.1.2
- v6.1.1
- v6.1.0
- v6.0.0
- v5.x-dev
- v5.7.1
- v5.7.0
- v5.6.0
- v5.5.4
- v5.5.3
- v5.5.2
- v5.5.1
- v5.5
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.4
- v5.3.3
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.6
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.11
- v5.1.10
- v5.1.9
- v5.1.8
- v5.1.7
- v5.1.6
- v5.1.5
- v5.1.4
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.1
- v5.0.0
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.1.1
- v1.1.0
- v1.0
- dev-dependabot/composer/phpstan/phpstan-tw-1.10or-tw-2.0
- dev-mgmt-160-deep-link-2-the-relinkening
- dev-submission-ext
- dev-revert-46-dependabot/composer/firebase/php-jwt-tw-5.2or-tw-6.0
This package is auto-updated.
Last update: 2024-11-11 13:40:45 UTC
README
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 optionallyPackback\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 KID
s 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