devlite/php

DevLite PHP SDK — Error tracking and performance monitoring for PHP applications

Maintainers

Package info

github.com/Ishimwe-Kevin/devlite-php

Homepage

Issues

pkg:composer/devlite/php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

dev-main 2026-04-23 11:41 UTC

This package is auto-updated.

Last update: 2026-04-23 14:46:13 UTC


README

Error tracking and performance monitoring for PHP applications.

Installation

composer require devlite/php

Supported Frameworks

  • Laravel - composer require devlite/php (auto-integrated)
  • Symfony - composer require devlite/php
  • WordPress - composer require devlite/php
  • CodeIgniter
  • Yii
  • CakePHP

Quick Start

<?php
require_once 'vendor/autoload.php';

use DevLite\DevLite;

DevLite::init([
    'dsn' => 'https://devlite.andasy.dev/api/metrics',
    'app_name' => 'my-app',
    'environment' => 'production'
]);

try {
    // your code
    $result = 1 / 0;
} catch (Throwable $e) {
    DevLite::captureException($e);
    throw $e;
}

API Reference

Initialization

DevLite::init([
    'dsn' => 'https://...',          // required
    'app_name' => 'my-app',          // default: APP_NAME env var
    'environment' => 'production',   // default: ENV env var
    'release' => 'v1.0.0',          // default: VERSION env var
    'sample_rate' => 1.0,              // sample rate (0.0-1.0)
]);

Capture Exception

try {
    risky_operation();
} catch (Throwable $e) {
    DevLite::captureException($e);
}

Capture Message

DevLite::captureMessage('User logged in', 'info');

Performance Tracking

$start = hrtime(true);
// your code
$durationMs = (hrtime(true) - $start) / 1_000_000;
DevLite::capturePerformance('database_query', $durationMs);

User Context

DevLite::setUser('123', 'user@example.com', 'username');

Middleware (PSR-15)

$app->use(DevLite::middleware());

Laravel Integration

// config/devlite.php
return [
    'dsn' => env('DEVLITE_DSN'),
    'app_name' => env('APP_NAME'),
    'environment' => env('APP_ENV'),
    'release' => env('APP_VERSION'),
];

// app/Exceptions/Handler.php
public function report(Throwable $e): void
{
    app(DevLite\Client::class)->captureException($e);
    parent::report($e);
}

WordPress Integration

// wp-config.php
require_once 'vendor/autoload.php';
DevLite::init(['dsn' => 'https://...']);

Environment Variables

Variable Description
DEVLITE_DSN DevLite DSN URL
APP_NAME Application name
ENV Environment (default: development)
VERSION Release version

License

MIT