streply/streply-laravel
最新稳定版本:v0.0.28
Composer 安装命令:
composer require streply/streply-laravel
包简介
Streply Laravel SDK
README 文档
README
Requirements
- PHP: 8.2, 8.3, or 8.4
- Laravel: 10.x, 11.x, or 12.x
Install
Install the streply/streply-laravel package:
composer require streply/streply-laravel
Add the service provider to config/app.php
This step is needed only for Laravel versions below 11.x.
// config/app.php Streply\Laravel\ServiceProvider::class,
Enable capturing exception
Laravel 12.x
Enable capturing exception in bootstrap/app.php:
<?php // bootstrap/app.php use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { // }) ->withExceptions(function (Exceptions $exceptions) { $exceptions->reportable(static function (Throwable $exception) { \Streply\Exception($exception); }); })->create();
Laravel 11.x
Enable capturing exception in bootstrap/app.php:
<?php // bootstrap/app.php use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { // }) ->withExceptions(function (Exceptions $exceptions) { $exceptions->reportable(static function (Throwable $exception) { \Streply\Exception($exception); }); })->create();
Laravel 8.x, 9.x and 10.x
Enable capturing exception in App/Exceptions/Handler.php:
<?php // App/Exceptions/Handler.php public function register() { $this->reportable(function (Throwable $e) { try { \Streply\Exception($e); } catch(\Exception $e) {} }); }
Configure
Configure the Streply DSN with this command:
php artisan streply:publish https://clientPublicKey@api.streply.com/projectId
Or manually add to your .env file:
STREPLY_DSN=https://clientPublicKey@api.streply.com/projectId
PHP 8.4 Compatibility
This package is fully compatible with PHP 8.4 and utilizes modern PHP features for better performance:
- Strict types for improved performance and type safety
- Enhanced error handling with better type checking
- Optimized for JIT compilation in PHP 8.4
Laravel 12 Support
This package supports Laravel 12.x with all new features:
- New application structure with bootstrap/app.php
- Modern exception handling configuration
- Full compatibility with Laravel 12 starter kits
统计信息
- 总下载量: 221
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-02