PHP code example of nxsspryker / sentry

1. Go to this page and download the library: Download nxsspryker/sentry library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nxsspryker / sentry example snippets




namespace Pyz\Service\NxsErrorHandler;

use NxsSpryker\Service\NxsErrorHandler\NxsErrorHandlerDependencyProvider as NxsSpyNxsErrorHandlerDependencyProvider;
use NxsSpryker\Service\Sentry\Business\Model\Handler\ErrorHandler;
use NxsSpryker\Service\Sentry\Business\Model\Handler\ExceptionHandler;
use NxsSpryker\Service\Sentry\Business\Model\Handler\ShutdownHandler;

class NxsErrorHandlerDependencyProvider extends NxsSpyNxsErrorHandlerDependencyProvider
{
    /**
     * @return array
     */
    protected function getErrorHandlerPlugins(): array
    {
        return [
            new ErrorHandler()
        ];
    }

    /**
     * @return array
     */
    protected function getExceptionHandlerPlugins(): array
    {
        return [
            new ExceptionHandler()
        ];
    }

    /**
     * @return array
     */
    protected function getShutdownHandlerPlugins(): array
    {
        return [
            new ShutdownHandler()
        ];
    }

}



namespace Pyz\Yves\ShopApplication;

use NxsSpryker\Yves\SentryWidget\Plugin\Provider\SentryWidgetPlugin;
use SprykerShop\Yves\ShopApplication\ShopApplicationDependencyProvider as SprykerShopApplicationDependencyProvider;

class ShopApplicationDependencyProvider extends SprykerShopApplicationDependencyProvider
{
 /**
  * @return string[]
  */
 protected function getGlobalWidgetPlugins(): array
 {
     return [
         // ...
         SentryWidgetPlugin::class
     ];
 }
}


use NxsSpryker\Service\Sentry\SentryConfig;

$config[SentryConfig::URL_KEY] = 'abc';
$config[SentryConfig::URL_DOMAIN] = 'sentry.io';
$config[SentryConfig::URL_PROJECT] = 'myproject';

$config[SentryConfig::IS_ACTIVE] = true;
$config[SentryConfig::CLIENT_URL] = sprintf(
    'https://%s@%s/%s',
    $config[SentryConfig::URL_KEY],
    $config[SentryConfig::URL_DOMAIN],
    $config[SentryConfig::URL_PROJECT]
);

use NxsSpryker\Yves\SentryWidget\SentryWidgetConfig;

$config[SentryWidgetConfig::URL_KEY] = 'abc';
$config[SentryWidgetConfig::URL_DOMAIN] = 'sentry.io';
$config[SentryWidgetConfig::URL_PROJECT] = 'myproject';

$config[SentryWidgetConfig::JS_IS_ACTIVE] = true;
$config[SentryWidgetConfig::JS_CLIENT_URL] = sprintf(
    'https://%s@%s/%s',
    $config[SentryWidgetConfig::URL_KEY],
    $config[SentryWidgetConfig::URL_DOMAIN],
    $config[SentryWidgetConfig::URL_PROJECT]
);