rusticisoftware/tincan
PHP library for implementing the Experience API (Tin Can/xAPI). Provides tools to build and send statements, integrate with an LRS, and work with xAPI data. Install via Composer, includes PHPUnit tests and phpDocumentor docs generation.
Pros:
Statement, Agent, Activity) fit Laravel’s dependency injection and service container patterns, reducing side-effect risks.asVersion('1.0.3')) simplifies compatibility with legacy LRS systems, critical for enterprise use cases.composer require rusticisoftware/tincan aligns with Laravel’s package management.Cons:
RemoteLRS), which may require customization for Laravel’s HTTP client (Guzzle) or middleware (e.g., retries, logging).RemoteLRS's native HTTP layer with Laravel’s Http facade or Guzzle for consistency.RemoteLRS calls in Laravel queues for async LRS communication (e.g., sending statements).StatementSent) to decouple xAPI logic from business workflows.statements table) before sending to LRS.Statement/Agent classes to implement Illuminate\Database\Eloquent\Model for local persistence.Http mocking).ContextActivities) may impact high-throughput systems.RemoteLRS behind a Laravel service to isolate HTTP/versioning logic.config to toggle between local caching and direct LRS calls.Guzzle for simpler use cases.illuminate/support, symfony/http-client).RemoteLRS's native HTTP layer with Laravel’s Http facade or Guzzle for consistency with other API calls.statements, agents, and activities if persistence is needed.RemoteLRS calls in Laravel queues (bus:send) for async processing, especially for high-volume systems.Phase 1: Proof of Concept (1–2 weeks)
composer require rusticisoftware/tincan.Statement sender using RemoteLRS (e.g., track a user completing a tutorial).Phase 2: Laravel Integration (2–3 weeks)
app/Services/XapiService.php) to wrap RemoteLRS:
class XapiService {
protected $remoteLRS;
public function __construct(RemoteLRS $remoteLRS) {
$this->remoteLRS = $remoteLRS;
}
public function sendStatement(Statement $statement) {
return $this->remoteLRS->sendStatement($statement);
}
}
AppServiceProvider:
public function register() {
$this->app->singleton(RemoteLRS::class, function ($app) {
return new RemoteLRS('https://lrs.example.com', 'xAPI', 'username', 'password');
});
}
RemoteLRS's HTTP client with Laravel’s Http facade or Guzzle.Phase 3: Advanced Features (3–4 weeks)
class SendStatementJob implements ShouldQueue {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $statement;
public function handle() {
app(XapiService::class)->sendStatement($this->statement);
}
}
Statement/Agent classes to support Eloquent for local persistence.void or context_activities), attachment handling.Phase 4: Testing & Optimization (2 weeks)
Http mocks (e.g., Http::fake()).strict_types=0 in the fork to avoid type hinting issues.openssl for HTTPS/LRS communication (standard in Laravel deployments).json extension (enabled by default in PHP).asVersion('1.0.3') for older systems).RemoteLRS configuration.How can I help you explore Laravel packages today?