\Raven_Client

Raven PHP Client

Summary

Methods
Properties
Constants
__construct()
__destruct()
close_all_children_link()
install()
getRelease()
setRelease()
getEnvironment()
setEnvironment()
getAppPath()
setAppPath()
getExcludedAppPaths()
setExcludedAppPaths()
getPrefixes()
setPrefixes()
getSendCallback()
setSendCallback()
getTransport()
getServerEndpoint()
getUserAgent()
setTransport()
getDefaultProcessors()
setProcessorsFromOptions()
parseDSN()
getLastError()
getIdent()
message()
exception()
captureMessage()
captureException()
captureLastError()
captureQuery()
getLastEventID()
get_default_data()
capture()
sanitize()
process()
sendUnsentErrors()
encode()
send()
getAuthHeader()
translateSeverity()
registerSeverityMap()
set_user_data()
onShutdown()
user_context()
tags_context()
extra_context()
setProcessors()
getLastSentryError()
getShutdownFunctionHasBeenSet()
close_curl_resource()
setSerializer()
setReprSerializer()
$breadcrumbs
$context
$extra_data
$severity_map
$store_errors_for_bulk_send
$logger
$server
$secret_key
$public_key
$project
$auto_log_stacks
$name
$site
$tags
$release
$environment
$sample_rate
$trace
$timeout
$message_limit
$exclude
$excluded_exceptions
$http_proxy
$curl_method
$curl_path
$curl_ipv4
$ca_cert
$verify_ssl
$curl_ssl_version
$trust_x_forwarded_proto
$mb_detect_order
$processors
$_lasterror
$_last_event_id
$_user
$_pending_events
$sdk
$useCompression
VERSION
PROTOCOL
DEBUG
INFO
WARN
WARNING
ERROR
FATAL
MESSAGE_LIMIT
getInputStream()
registerDefaultBreadcrumbHandlers()
registerShutdownFunction()
is_http_request()
get_http_data()
get_user_data()
get_extra_data()
send_remote()
get_default_ca_cert()
get_curl_options()
send_http()
buildCurlCommand()
send_http_asynchronous_curl_exec()
send_http_synchronous()
get_auth_header()
uuid4()
get_current_url()
isHttps()
$error_handler
$error_types
$serializer
$reprSerializer
$app_path
$prefixes
$excluded_app_paths
$transport
$send_callback
$_last_sentry_error
$_curl_handler
$_curl_instance
$_shutdown_function_has_been_set
N/A
getDefaultPrefixes()
_convertPath()
_server_variable()
triggerAutoload()
No private properties found
N/A

Constants

VERSION

VERSION = '1.9.x-dev'

PROTOCOL

PROTOCOL = '6'

DEBUG

DEBUG = 'debug'

INFO

INFO = 'info'

WARN

WARN = 'warning'

WARNING

WARNING = 'warning'

ERROR

ERROR = 'error'

FATAL

FATAL = 'fatal'

MESSAGE_LIMIT

MESSAGE_LIMIT = 1024

Properties

$breadcrumbs

$breadcrumbs : 

Type

$extra_data

$extra_data : 

Type

$severity_map

$severity_map : array|null

Type

array|null

$store_errors_for_bulk_send

$store_errors_for_bulk_send : 

Type

$logger

$logger : 

Type

$server

$server : string

Type

string — Full URL to Sentry

$secret_key

$secret_key : 

Type

$public_key

$public_key : 

Type

$project

$project : 

Type

$auto_log_stacks

$auto_log_stacks : 

Type

$name

$name : 

Type

$site

$site : 

Type

$tags

$tags : 

Type

$release

$release : 

Type

$environment

$environment : 

Type

$sample_rate

$sample_rate : 

Type

$trace

$trace : 

Type

$timeout

$timeout : 

Type

$message_limit

$message_limit : 

Type

$exclude

$exclude : 

Type

$excluded_exceptions

$excluded_exceptions : 

Type

$http_proxy

$http_proxy : 

Type

$curl_method

$curl_method : 

Type

$curl_path

$curl_path : 

Type

$curl_ipv4

$curl_ipv4 : 

Type

$ca_cert

$ca_cert : 

Type

$verify_ssl

$verify_ssl : 

Type

$curl_ssl_version

$curl_ssl_version : 

Type

$trust_x_forwarded_proto

$trust_x_forwarded_proto : 

Type

$mb_detect_order

$mb_detect_order : 

Type

$processors

$processors : array<mixed,\Raven_Processor>

Type

array<mixed,\Raven_Processor>

$_lasterror

$_lasterror : string|integer|null

Type

string|integer|null

$_last_event_id

$_last_event_id : 

Type

$_user

$_user : 

Type

$_pending_events

$_pending_events : 

Type

$sdk

$sdk : 

Type

$useCompression

$useCompression : boolean

Type

boolean

$error_handler

$error_handler : 

Type

$error_types

$error_types : 

Type

$app_path

$app_path : string

Type

string

$prefixes

$prefixes : array<mixed,string>

Type

array<mixed,string>

$excluded_app_paths

$excluded_app_paths : array<mixed,string>|null

Type

array<mixed,string>|null

$transport

$transport : Callable

Type

Callable

$send_callback

$send_callback : 

Type

$_last_sentry_error

$_last_sentry_error : object|null

Type

object|null

$_curl_instance

$_curl_instance : resource|null

Type

resource|null

$_shutdown_function_has_been_set

$_shutdown_function_has_been_set : boolean

Type

boolean

Methods

__construct()

__construct(  $options_or_dsn = null,   $options = array()) 

Parameters

$options_or_dsn
$options

__destruct()

__destruct() 

close_all_children_link()

close_all_children_link() 

Destruct all objects contain link to this object

This method can not delete shutdown handler

install()

install() 

Installs any available automated hooks (such as error_reporting).

getRelease()

getRelease() 

setRelease()

setRelease(  $value) 

Parameters

$value

getEnvironment()

getEnvironment() 

setEnvironment()

setEnvironment(  $value) 

Parameters

$value

getAppPath()

getAppPath() 

setAppPath()

setAppPath(  $value) 

Parameters

$value

getExcludedAppPaths()

getExcludedAppPaths() 

setExcludedAppPaths()

setExcludedAppPaths(  $value) 

Parameters

$value

getPrefixes()

getPrefixes() 

setPrefixes()

setPrefixes(array  $value) : \Raven_Client

Parameters

array $value

Returns

\Raven_Client

getSendCallback()

getSendCallback() 

setSendCallback()

setSendCallback(  $value) 

Parameters

$value

getTransport()

getTransport() 

getServerEndpoint()

getServerEndpoint(  $value = '') 

Parameters

$value

getUserAgent()

getUserAgent() 

setTransport()

setTransport(Callable  $value) : \Raven_Client

Set a custom transport to override how Sentry events are sent upstream.

The bound function will be called with $client and $data arguments and is responsible for encoding the data, authenticating, and sending the data to the upstream Sentry server.

Parameters

Callable $value

Function to be called

Returns

\Raven_Client

getDefaultProcessors()

getDefaultProcessors() : array<mixed,string>|array<mixed,\Raven_Processor>

Returns

array<mixed,string>|array<mixed,\Raven_Processor>

setProcessorsFromOptions()

setProcessorsFromOptions(  $options) : array<mixed,\Raven_Processor>

Sets the Raven_Processor sub-classes to be used when data is processed before being sent to Sentry.

Parameters

$options

Returns

array<mixed,\Raven_Processor>

parseDSN()

parseDSN(string  $dsn) : array

Parses a Raven-compatible DSN and returns an array of its values.

Parameters

string $dsn

Raven compatible DSN

Returns

array —

parsed DSN

getLastError()

getLastError() 

getIdent()

getIdent(mixed  $ident) : mixed

Given an identifier, returns a Sentry searchable string.

Parameters

mixed $ident

Returns

mixed

message()

message(string  $message, array  $params = array(), string  $level = self::INFO, boolean|array  $stack = false, mixed  $vars = null) : string|null

Parameters

string $message

The message (primary description) for the event.

array $params

params to use when formatting the message.

string $level

Log level group

boolean|array $stack
mixed $vars

Returns

string|null

exception()

exception(\Exception  $exception) : string|null

Parameters

\Exception $exception

Returns

string|null

captureMessage()

captureMessage(string  $message, array  $params = array(), array  $data = array(), boolean|array  $stack = false, mixed  $vars = null) : string|null

Log a message to sentry

Parameters

string $message

The message (primary description) for the event.

array $params

params to use when formatting the message.

array $data

Additional attributes to pass with this event (see Sentry docs).

boolean|array $stack
mixed $vars

Returns

string|null

captureException()

captureException(\Throwable|\Exception  $exception, array  $data = null, mixed  $logger = null, mixed  $vars = null) : string|null

Log an exception to sentry

Parameters

\Throwable|\Exception $exception

The Throwable/Exception object.

array $data

Additional attributes to pass with this event (see Sentry docs).

mixed $logger
mixed $vars

Returns

string|null

captureLastError()

captureLastError() : string|null

Capture the most recent error (obtained with ``error_get_last``).

Returns

string|null

captureQuery()

captureQuery(string|null  $query, string  $level = self::INFO, string  $engine = '') 

Log an query to sentry

Parameters

string|null $query
string $level
string $engine

getLastEventID()

getLastEventID() 

Return the last captured event's ID or null if none available.

get_default_data()

get_default_data() 

capture()

capture(  $data,   $stack = null,   $vars = null) 

Parameters

$data
$stack
$vars

sanitize()

sanitize(  $data) 

Parameters

$data

process()

process(array  $data) 

Process data through all defined Raven_Processor sub-classes

Parameters

array $data

Associative array of data to log

sendUnsentErrors()

sendUnsentErrors() 

encode()

encode(array  $data) : string|boolean

Parameters

array $data

Returns

string|boolean

send()

send(array  $data) 

Wrapper to handle encoding and sending data to the Sentry API server.

Parameters

array $data

Associative array of data to log

getAuthHeader()

getAuthHeader() 

translateSeverity()

translateSeverity(string  $severity) : string

Translate a PHP Error constant into a Sentry log level group

Parameters

string $severity

PHP E_$x error constant

Returns

string —

Sentry log level group

registerSeverityMap()

registerSeverityMap(array  $map) 

Provide a map of PHP Error constants to Sentry logging groups to use instead of the defaults in translateSeverity()

Parameters

array $map

set_user_data()

set_user_data(string  $id, string|null  $email = null, array  $data = array()) 

Convenience function for setting a user's ID and Email

Parameters

string $id

User's ID

string|null $email

User's email

array $data

Additional user data

onShutdown()

onShutdown() 

user_context()

user_context(array  $data, boolean  $merge = true) 

Sets user context.

Parameters

array $data

Associative array of user data

boolean $merge

Merge existing context with new context

tags_context()

tags_context(array  $data) 

Appends tags context.

Parameters

array $data

Associative array of tags

extra_context()

extra_context(array  $data) 

Appends additional context.

Parameters

array $data

Associative array of extra data

setProcessors()

setProcessors(array  $processors) 

Parameters

array $processors

getLastSentryError()

getLastSentryError() : object|null

Returns

object|null

getShutdownFunctionHasBeenSet()

getShutdownFunctionHasBeenSet() : boolean

Returns

boolean

close_curl_resource()

close_curl_resource() 

setSerializer()

setSerializer(\Raven_Serializer  $serializer) 

Parameters

\Raven_Serializer $serializer

setReprSerializer()

setReprSerializer(\Raven_ReprSerializer  $reprSerializer) 

Parameters

\Raven_ReprSerializer $reprSerializer

getInputStream()

getInputStream() 

Note: Prior to PHP 5.6, a stream opened with php://input can only be read once;

registerDefaultBreadcrumbHandlers()

registerDefaultBreadcrumbHandlers() 

registerShutdownFunction()

registerShutdownFunction() 

is_http_request()

is_http_request() : boolean

Returns

boolean

get_http_data()

get_http_data() 

get_user_data()

get_user_data() 

get_extra_data()

get_extra_data() 

send_remote()

send_remote(string  $url, array|string  $data, array  $headers = array()) 

Send data to Sentry

Parameters

string $url

Full URL to Sentry

array|string $data

Associative array of data to log

array $headers

Associative array of headers

get_default_ca_cert()

get_default_ca_cert() 

get_curl_options()

get_curl_options() : array

Returns

array

send_http()

send_http(string  $url, array|string  $data, array  $headers = array()) 

Send the message over http to the sentry url given

Parameters

string $url

URL of the Sentry instance to log to

array|string $data

Associative array of data to log

array $headers

Associative array of headers

buildCurlCommand()

buildCurlCommand(  $url,   $data,   $headers) 

Parameters

$url
$data
$headers

send_http_asynchronous_curl_exec()

send_http_asynchronous_curl_exec(string  $url, array|string  $data, array  $headers) : boolean

Send the cURL to Sentry asynchronously. No errors will be returned from cURL

Parameters

string $url

URL of the Sentry instance to log to

array|string $data

Associative array of data to log

array $headers

Associative array of headers

Returns

boolean

send_http_synchronous()

send_http_synchronous(string  $url, array|string  $data, array  $headers) : boolean

Send a blocking cURL to Sentry and check for errors from cURL

Parameters

string $url

URL of the Sentry instance to log to

array|string $data

Associative array of data to log

array $headers

Associative array of headers

Returns

boolean

get_auth_header()

get_auth_header(string  $timestamp, string  $client, string  $api_key, string  $secret_key) : string

Generate a Sentry authorization header string

Parameters

string $timestamp

Timestamp when the event occurred

string $client

HTTP client name (not Raven_Client object)

string $api_key

Sentry API key

string $secret_key

Sentry API key

Returns

string

uuid4()

uuid4() : string

Generate an uuid4 value

Returns

string

get_current_url()

get_current_url() : string|null

Return the URL for the current request

Returns

string|null

isHttps()

isHttps() : boolean

Was the current request made over https?

Returns

boolean

getDefaultPrefixes()

getDefaultPrefixes() 

_convertPath()

_convertPath(  $value) 

Parameters

$value

_server_variable()

_server_variable(string  $key) : string

Get the value of a key from $_SERVER

Parameters

string $key

Key whose value you wish to obtain

Returns

string —

Key's value

triggerAutoload()

triggerAutoload()