Get support for yiisoft/yii-sentry
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
yiisoft/yii-sentry
The package provides Sentry integration for Yii Framework.
Requirements
- PHP 8.0 or higher.
Installation
The package could be installed with Composer.
The package needs PSR-compatible HTTP client and factories so require it additionally to this package:
composer install httpsoft/http-message
composer install php-http/guzzle7-adapter
composer install yiisoft/yii-sentry
The first two can be replaced to other packages of your choice.
For handling console errors yii-console
and yii-event
packages are required additionally:
composer install yiisoft/yii-console
composer install yiisoft/yii-event
Configure HTTP factories and client (usually that is config/common/di/sentry.php
):
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\ClientInterface;
use Http\Adapter\Guzzle7\Client as GuzzleClientAdapter;
use Http\Client\HttpAsyncClient;
use HttpSoft\Message\RequestFactory;
use HttpSoft\Message\ResponseFactory;
use HttpSoft\Message\StreamFactory;
use HttpSoft\Message\UriFactory;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Yiisoft\Definitions\Reference;
return [
// HTTP Factories
StreamFactoryInterface::class => StreamFactory::class,
RequestFactoryInterface::class => RequestFactory::class,
LoggerInterface::class => NullLogger::class,
UriFactoryInterface::class => UriFactory::class,
ResponseFactoryInterface::class => ResponseFactory::class,
// HTTP Client
HttpClient::class => GuzzleClient::class,
HttpAsyncClient::class => [
'class' => GuzzleClientAdapter::class,
'__construct()' => [
Reference::to(ClientInterface::class),
],
],
];
Then add SentryMiddleware
to main application middleware set and configure DSN in config/params.php
. Console errors
are captured by default, there is no need to configure anything.
return [
// ...
'middlewares' => [
ErrorCatcher::class,
SentryMiddleware::class, // <-- here
SessionMiddleware::class,
CookieMiddleware::class,
CookieLoginMiddleware::class,
LocaleMiddleware::class,
Router::class,
],
// ...
'yiisoft/yii-sentry' => [
'handleConsoleErrors' => false, // Add to disable console errors.
'options' => [
// Set to `null` to disable error sending (note that in case of web application errors it only prevents
// sending them via HTTP). To disable interactions with Sentry SDK completely, remove middleware and the
// rest of the config.
'dsn' => $_ENV['SENTRY_DSN'] ?? null,
'environment' => $_ENV['YII_ENV'] ?? null, // Add to separate "production" / "staging" environment errors.
],
],
// ...
]
Note that fatal errors are handled too.
In options
you can also pass additional Sentry configuration. See
official Sentry docs for keys and values.
Documentation
If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.
License
The Yii Sentry is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.
Maintained by Yii Software.
Support the project
Follow updates
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2