PHPackages                             izumi-kun/yii2-lti-tool-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. izumi-kun/yii2-lti-tool-provider

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

izumi-kun/yii2-lti-tool-provider
================================

LTI Tool module for Yii2

1.0.1(1y ago)1481[1 issues](https://github.com/Izumi-kun/yii2-lti-tool-provider/issues)BSD-3-ClausePHPPHP &gt;=8.1CI passing

Since Jun 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Izumi-kun/yii2-lti-tool-provider)[ Packagist](https://packagist.org/packages/izumi-kun/yii2-lti-tool-provider)[ RSS](/packages/izumi-kun-yii2-lti-tool-provider/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (8)Dependencies (5)Versions (12)Used By (0)

Yii2 LTI Tool
=============

[](#yii2-lti-tool)

LTI Tool module for Yii2.

[![Latest Stable Version](https://camo.githubusercontent.com/a39611fecd9bc65ccad0014210726bac199d51ec4f250275dadab78774419dfe/68747470733a2f2f706f7365722e707567782e6f72672f697a756d692d6b756e2f796969322d6c74692d746f6f6c2d70726f76696465722f762f737461626c65)](https://packagist.org/packages/izumi-kun/yii2-lti-tool-provider)[![Total Downloads](https://camo.githubusercontent.com/a3b003c333c0d1e08ade59fbd9f4c08183b5f134df990ac1c373d1961a749707/68747470733a2f2f706f7365722e707567782e6f72672f697a756d692d6b756e2f796969322d6c74692d746f6f6c2d70726f76696465722f646f776e6c6f616473)](https://packagist.org/packages/izumi-kun/yii2-lti-tool-provider)[![License](https://camo.githubusercontent.com/7788f1d2c1a5889786b0a3953dbf95be7ecba4ba5c51c1f6d09cdcdf65d4194f/68747470733a2f2f706f7365722e707567782e6f72672f697a756d692d6b756e2f796969322d6c74692d746f6f6c2d70726f76696465722f6c6963656e7365)](https://packagist.org/packages/izumi-kun/yii2-lti-tool-provider)

Installation
------------

[](#installation)

```
composer require izumi-kun/yii2-lti-tool-provider

```

Usage
-----

[](#usage)

### Migrations

[](#migrations)

Add namespaced migrations: `izumi\yii2lti\migrations`. Apply new migrations.

### Application config

[](#application-config)

Add the module to the web config and configure it. The module supports the following events for handling messages from Platforms:

- `launch`
- `configure`
- `dashboard`
- `contentItem`
- `contentItemUpdate`
- `submissionReview`

Make sure to configure access to the `lti/platform` controller actions. All messages from Platforms are handled by the `lti/tool` controller, and there are no access restrictions.

```
$config = [
    'modules' => [
        'lti' => [
            'class' => \izumi\yii2lti\Module::class,
            'tool' => [
                'debugMode' => YII_DEBUG,
                'rsaKey' => 'A PEM formatted private key (for LTI 1.3 support)',
            ],
            'on launch' => [SiteController::class, 'ltiLaunch'],
            'on error' => [SiteController::class, 'ltiError'],
            'as access' => [
                'class' => \yii\filters\AccessControl::class,
                'rules' => [
                    ['allow' => true, 'controllers' => ['lti/tool']],
                    ['allow' => true, 'controllers' => ['lti/platform'], 'roles' => ['admin']],
                ],
            ],
        ],
    ],
];
```

### Event handlers

[](#event-handlers)

Create event handlers according to the module configuration.

```
namespace app\controllers;

use izumi\yii2lti\ToolEvent;
use Yii;
use yii\web\BadRequestHttpException;
use yii\web\Controller;

class SiteController extends Controller
{
    /**
     * basic-lti-launch-request handler
     * @param ToolEvent $event
     */
    public static function ltiLaunch(ToolEvent $event)
    {
        $tool = $event->sender;

        // $userPk can be used for user identity
        $userPk = $tool->user->getRecordId();
        $isAdmin = $tool->user->isStaff() || $tool->user->isAdmin();

        Yii::$app->session->set('isAdmin', $isAdmin);
        Yii::$app->session->set('userPk', $userPk);
        Yii::$app->controller->redirect(['/site/index']);

        $tool->ok = true;
        $event->handled = true;
    }

    /**
     * LTI error handler
     * @param ToolEvent $event
     * @throws BadRequestHttpException
     */
    public static function ltiError(ToolEvent $event)
    {
        $tool = $event->sender;
        $msg = $tool->message;
        if (!empty($tool->reason)) {
            Yii::error($tool->reason);
            if ($tool->debugMode) {
                $msg = $tool->reason;
            }
        }
        throw new BadRequestHttpException($msg);
    }
}
```

### Outcome

[](#outcome)

```
use ceLTIc\LTI;

/* @var \izumi\yii2lti\Module $module */
$module = Yii::$app->getModule('lti');

$user = $module->findUserById(Yii::$app->session->get('userPk'));

$result = '0.8';
$outcome = new LTI\Outcome($result);

if ($module->doOutcomesService(LTI\Enum\ServiceAction::Write, $outcome, $user)) {
    Yii::$app->session->addFlash('success', 'Result sent successfully');
}
```

### Sample app

[](#sample-app)

### Useful

[](#useful)

- [LTI Platform emulator](https://saltire.lti.app/platform)
- [celtic-project/LTI-PHP/wiki](https://github.com/celtic-project/LTI-PHP/wiki)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~359 days

Recently: every ~573 days

Total

8

Last Release

383d ago

Major Versions

0.6.0 → 1.0.02024-09-02

PHP version history (2 changes)0.1.0PHP &gt;=5.4.0

1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/bae10d46a49e5c46dc6ea1afb6384a41071c45568612a2ae8e0a0dcdda68f4af?d=identicon)[Izumi-kun](/maintainers/Izumi-kun)

---

Top Contributors

[![Izumi-kun](https://avatars.githubusercontent.com/u/1062584?v=4)](https://github.com/Izumi-kun "Izumi-kun (54 commits)")

---

Tags

ltilti-providerwipyii2yii2-extension

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/izumi-kun-yii2-lti-tool-provider/health.svg)

```
[![Health](https://phpackages.com/badges/izumi-kun-yii2-lti-tool-provider/health.svg)](https://phpackages.com/packages/izumi-kun-yii2-lti-tool-provider)
```

###  Alternatives

[asinfotrack/yii2-toolbox

Yii2-Toolbox is a collection of useful helpers, widgets etc. extending the basic functionality of Yii2

1230.5k5](/packages/asinfotrack-yii2-toolbox)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
