Skip to content

Add LTI 1.3 Dynamic Registration support#174

Open
pb-sobrien wants to merge 3 commits into
masterfrom
lti-dynamic-registration
Open

Add LTI 1.3 Dynamic Registration support#174
pb-sobrien wants to merge 3 commits into
masterfrom
lti-dynamic-registration

Conversation

@pb-sobrien

Copy link
Copy Markdown

Summary

  • Implements the IMS LTI Dynamic Registration spec with four new classes under Packback\Lti1p3\DynamicRegistration
  • OidcConfiguration — value object for platform OpenID Configuration response with fromJson()/fromArray() factory methods and required field validation
  • RegistrationPayload — builds the registration POST body per IMS spec, including LTI tool configuration, message types, custom parameters, and null filtering
  • RegistrationResponse — value object for platform registration response, extracts client_id and deployment_id from nested LTI tool config key
  • DynamicRegistrationService — Guzzle-based HTTP client with fetchOpenIdConfiguration() and register() methods, wrapping HTTP errors in LtiException

Test plan

  • 36 new tests passing (87 assertions) across 4 test files
  • Happy paths: construction, JSON parsing, array parsing, HTTP calls with/without bearer token
  • Error cases: invalid JSON, missing required fields, empty required fields, HTTP failures
  • composer lint-fix — passes (Pint)
  • vendor/bin/phpstan analyse — 0 errors
  • composer test — all tests pass

🤖 Generated with Claude Code

Implement the IMS LTI Dynamic Registration spec (lti-dr/v1p0) with four
new classes under Packback\Lti1p3\DynamicRegistration:

- OidcConfiguration: value object for platform OpenID Configuration
- RegistrationPayload: builds the registration POST body per IMS spec
- RegistrationResponse: value object for platform registration response
- DynamicRegistrationService: Guzzle HTTP client for the two network calls

Includes full test coverage (36 tests, 87 assertions) for happy paths
and error cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pb-sobrien pb-sobrien requested a review from dbhynds as a code owner May 19, 2026 11:00
@coveralls

coveralls commented May 19, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 98.433% (+0.09%) from 98.341% — lti-dynamic-registration into master

Omit the OAuth scope parameter when no scopes are requested (empty
string is invalid per RFC 7591 and can cause strict platforms to
reject registrations). Extract magic strings to class constants,
replace array_filter with explicit conditionals, and DRY up test
helper methods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines +9 to +11
private const LTI_TOOL_CONFIG_KEY = 'https://purl.imsglobal.org/spec/lti-tool-configuration';
private const MESSAGE_TYPE_RESOURCE_LINK = 'LtiResourceLinkRequest';
private const MESSAGE_TYPE_DEEP_LINKING = 'LtiDeepLinkingRequest';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should all reference LtiConstants instead

/**
* Build the registration POST body per the IMS spec.
*/
public function toArray(): array

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the Arrayable concern instead


class RegistrationResponse
{
private const LTI_TOOL_CONFIG_KEY = 'https://purl.imsglobal.org/spec/lti-tool-configuration';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constants go in LtiConstants

Move LTI tool configuration constant to LtiConstants, replace local
message type constants with LtiConstants references, and adopt the
Arrayable concern in RegistrationPayload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dbhynds dbhynds self-assigned this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants