Skip to content

Commit 6035f18

Browse files
authored
Merge pull request #32 from IMSGlobal/composer
Add composer support and move examples out of this repo
2 parents 0eca5f9 + 3b9f00f commit 6035f18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+63
-2448
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.lock
44
src/game_example/db/keys/*
55
src/game_example/db/configs/local.json
66
.env
7+
.DS_Store

Dockerfile

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,36 @@
1-
# LTI 1.3 Advantage Demo Tool And Library
2-
This code consists of two parts:
3-
A library for creating LTI tool providers in PHP.
4-
An collection of example tools that utilize the library.
5-
6-
# Running The Example Code
7-
8-
## Setup
9-
The example is all written in PHP, and it also contains a docker compose file for easy setup if you have docker installed.
10-
11-
### Registration and Deployment
12-
First thing you will need is to configure your registration and deployment in the example code's fake registrations database.
13-
14-
This can be found in each example tool's code at `db/configs/local.json`.
15-
To configure your registration add a JSON object into the `local.json` file in the following format.
16-
17-
```javascript
18-
{
19-
"<issuer>" : { // This will usually look something like 'http://example.com'
20-
"client_id" : "<client_id>", // This is the id received in the 'aud' during a launch
21-
"auth_login_url" : "<auth_login_url>", // The platform's OIDC login endpoint
22-
"auth_token_url" : "<auth_token_url>", // The platform's service authorization endpoint
23-
"key_set_url" : "<key_set_url>", // The platform's JWKS endpoint
24-
"private_key_file" : "<path_to_private_key>", // Relative path to the tool's private key
25-
"deployment" : {
26-
"<deployment_id>" : "<deployment_id>" // The deployment_id passed by the platform during launch
27-
}
28-
}
29-
}
30-
```
311

32-
### Running in Docker
33-
To run in docker you will need both `docker` and `docker-compose`
2+
| **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 |
3+
| --- |
344

35-
To get the examples up and running in docker simply run:
36-
```
37-
docker-compose up --build
38-
```
39-
40-
There are now two example tools you can launch into on the port 9001:
41-
```
42-
Simple Example:
43-
OIDC Login URL http://localhost:9001/example/login.php
44-
LTI Launch URL http://localhost:9001/example/launch.php
45-
46-
Game Example:
47-
OIDC Login URL http://localhost:9001/game_example/login.php
48-
LTI Launch URL http://localhost:9001/game_example/game.php
49-
```
50-
51-
You're now free to launch in and use the tool.
5+
# LTI 1.3 Advantage Library
6+
This code consists of a library for creating LTI tool providers in PHP.
527

538
# Library Documentation
549

5510
## Importing the library
11+
### Using Composer
12+
Add the following to your `composer.json` file
13+
```json
14+
"repositories": [
15+
{
16+
"type": "vcs",
17+
"url": "https://github.com/IMSGlobal/lti-1-3-php-library"
18+
}
19+
],
20+
"require": {
21+
"imsglobal/lti-1p3-tool": "dev-master"
22+
}
23+
```
24+
Run `composer install` or `composer update`
25+
In your code, you will now be able to use classes in the `\IMSGlobal\LTI` namespace to access the library.
26+
5627
### Manually
5728
To import the library, copy the `lti` folder inside `src` into your project and use the following code at the beginning of execution:
5829
```php
5930
require_once('lti/lti.php');
6031
use \IMSGlobal\LTI;
6132
```
6233

63-
### Using Composer
64-
Coming soon...
65-
6634
## Accessing Registration Data
6735

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

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
"name": "imsglobal/lti-1p3-tool",
33
"type": "library",
44
"require": {
5-
"firebase/php-jwt": "^5.0"
5+
"fproject/php-jwt": "^4.0",
6+
"phpseclib/phpseclib": "^2.0"
67
},
78
"autoload": {
89
"psr-4": {
9-
"IMSGlobal\\LTI": "src/lti"
10+
"IMSGlobal\\LTI\\": "src/lti"
1011
}
1112
},
1213
"authors": [

docker-compose.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/example/cert_suite_private.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/example/deep_link_response.php

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/example/example_database.php

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/example/grade.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/example/launch.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)