PHP code example of james-and-james-fulfilment / amg-sentry-plugin

1. Go to this page and download the library: Download james-and-james-fulfilment/amg-sentry-plugin 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/ */

    

james-and-james-fulfilment / amg-sentry-plugin example snippets


// config/ProjectConfiguration.class.php

/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{
    public function setup()
    {
        $this->enablePlugins(array(
            'amgSentryPlugin',
            ...
        ));

        // mandatory because of the Composer vendor directory naming scheme
        sfConfig::set('sf_sentry_path', sfConfig::get('sf_lib_dir') . '/vendor/sentry/sentry');
    }
}

class ProjectConfiguration extends sfProjectConfiguration
{
	public function setup()
	{
		$this->enablePlugins(array(
			'sfDoctrinePlugin',
			'amgSentryPlugin',
			'...'
		));
	}
}

// send a message with no description and information level (by default)
amgSentry::sendMessage('Message title');

// send a debug message
amgSentry::sendMessage('Debug message title', 'Debug message description', amgSentry::DEBUG);

// send a warning message
amgSentry::sendMessage('Warning message title', 'Warning message description', amgSentry::WARNING);

// send an error message
amgSentry::sendMessage('Error message title', 'Error message description', amgSentry::ERROR);

// send an exception
amgSentry::sendException(new Exception('Exception message'), 'Exception description');

// set logger
amgSentry::setLogger('new-logger');

// reset logger
amgSentry::resetLogger();

// send a message with no description and information level (by default)
sentry_send_message('Message title');

// send a debug message
sentry_send_message('Debug message title', 'Debug message description', amgSentry::DEBUG);

// send a warning message
sentry_send_message('Warning message title', 'Warning message description', amgSentry::WARNING);

// send an error message
sentry_send_message('Error message title', 'Error message description', amgSentry::ERROR);

// send an exception
sentry_send_exception(new Exception('Exception message'), 'Exception description');

// set logger
sentry_set_logger('new-logger');

// reset logger
sentry_reset_logger();

// log a debug message
sfContext::getInstance()->getLogger()->debug('Debug message');

// log an error message
sfContext::getInstance()->getLogger()->err('Error message');