Download the PHP package devexpress/logify.alert.php without Composer
On this page you can find all versions of the php package devexpress/logify.alert.php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devexpress/logify.alert.php
More information about devexpress/logify.alert.php
Files in devexpress/logify.alert.php
Package logify.alert.php
Short Description Logify Alert Client for PHP Applications
License proprietary
Informations about the package logify.alert.php
Logify Alert for PHP applications
A PHP client to report exceptions to Logify Alert.
Install
Install manually
- Copy the Logify folder to your PHP project.
- Use the code below to include the LoadHelper.php file to the PHP script you use to call the Logify API. .
- Register the library autoloader by executing the following code:
All classes in the library are wrapped in the DevExpress\Logify namespace. Apply the use operator as demonstrated below to get rid of long names in your code:
Install with Composer
- Create a file in your project's root folder or use an existing one.
-
Add the section below to the file.
- Execute the following command:
- Add , to your PHP project. All classes in the client library are wrapped in the DevExpress\Logify namespace. Apply the use operator as demonstrated below to get rid of long names in your code:
Quick Start
Automatic error reporting
Manual error reporting
Configuration
You can set up the Logify Alert client using the config.php file:
Execute the code below so the Logify client uses the created configuration file.
API
Properties
apiKey
String. Specifies an API Key used to register an application within the Logify service.
appName
String. Specifies the application name.
appVersion
String. Specifies the application version.
attachments
Attachments collection. Specifies a collection of files attached to a report. The total attachments size must not exceed 3 Mb per crash report. The attachment name must be unique within a crash report.
breadcrumbs
BreadcrumbsCollection. Specifies a collection of breadcrums attached to a report. The total breadcrumbs size must not exceed 3 Mb per crash report.
breadcrumbsMaxCount
Integer. The default value is 1000. Specifies the maximum allowed size of attached breadcrumbs.
collectExtensions
Boolean. The default value is false. Specifies whether loaded PHP extensions are collected and sent to the server.
customData
Array. Gets the collection of custom data sent with generated reports. Use the customData property to attach additional information to the generated report. For instance, you can use this property to track additional metrics that are important regarding your application: CPU usage, environment parameters, etc.
tags
Array. Gets the collection of tags specifying additional fields from a raw report, which will be used in auto ignoring, filtering or detecting duplicates. A key is a tag name (a string that consists of a-z, A-Z, 0-9, and _ characters), and a value is a tag value that is saved to a report. A new tag is added with Allow search enabled.
Ignore Variables
Specifies configuration values used to enable the $GLOBALS system values collection.
Note: Before collecting $GLOBALS system values, make sure none of them stores personal or private data (passwords, logins, and etc.). If so, use the ignoreKeyPattern property to exclude the required key's value from collecting.
A regular expression to exclude personal or private data (passwords, logins, and etc.) from collecting the $GLOBALS system values. The default value is NULL - all system values are collected.
Boolean. The default value is false. Specifies whether the $_GET array's data is collected and sent to the server.
Boolean. The default value is false. Specifies whether the $_POST array's data is collected and sent to the server.
Boolean. The default value is false. Specifies whether the $_COOKIE array's data is collected and sent to the server.
Boolean. The default value is false. Specifies whether the $_FILES array's data is collected and sent to the server.
Boolean. The default value is false. Specifies whether the $_ENV array's data is collected and sent to the server.
Boolean. The default value is false. Specifies whether the $_REQUEST array's data is collected and sent to the server.
Boolean. The default value is false. Specifies whether the $_SERVER array's data is collected and sent to the server.
offlineReportsCount
Integer. Specifies how many previous reports are kept once an Internet connection is lost. Reports are only saved when the OfflineReportsEnabled property is set to *true.
offlineReportsDirectory
String. Specifies a directory path for storing reports once an Internet connection is lost. Reports are only saved when the OfflineReportsEnabled property is set to true.
offlineReportsEnabled
Boolean. The default value is false. Specifies if Logify should store the last offlineReportsCount reports once an Internet connection is lost. Call the send_offline_reports method to send the kept reports once an Internet connection is available.
pathToConfigFile
String. Specifies the configuration file path. Refer to the Configuration section above for more information on the configuration file structure.
userId
String. Specifies a unique user identifier that corresponds to the sent report.
Static Methods
get_instance
Returns a single instance of the LogifyAlert class.
Methods for automatic reporting
Logify Alert allows you to listen to uncaught exceptions and deliver crash reports automatically using the methods below.
start_exceptions_handling()
Commands Logify Alert to start listening to uncaught exceptions and sends reports for all processed exceptions.
stop_exceptions_handling()
Commands Logify Alert to stop listening to uncaught exceptions.
Methods for manual reporting
Alternatively, Logify Alert allows you to catch the required exceptions manually, generate reports based on caught exceptions and send these reports only. For this purpose, use the methods below.
send(Exception $ex)
Generates a crash report based on the caught exception and sends this report to the Logify Alert service.
send(Exception $ex, $customData)
Sends the caught exception with the specified custom data to the Logify Alert service.
send(Exception $ex, $customData, $attachments)
Sends the caught exception with the specified custom data and attachments to the Logify Alert service.
send_offline_reports()
Sends all reports saved in the offlineReportsDirectory folder to the Logify Alert service.
Methods for Breadcrumbs Collecting
breadcrumbs->add($message)
Adds a breadcrumb with the specified message to the breadcrumbs collection. The default parameter value is an empty string ($message = "").
breadcrumbs->add($message, $category)
Adds a breadcrumb with the specified message and category to the breadcrumbs collection. The default category is an empty string ($category = "").
breadcrumbs->add($message, $category, $dateTime)
Adds a breadcrumb with the specified message, category and date/time to the breadcrumbs collection. The default date/time is UTC ($dateTime = date_create('UTC')->format('Y-m-d H:i:s')).
breadcrumbs->add($message, $category, $dateTime, $level)
Adds a breadcrumb with the specified message, category, date/time and level to the breadcrumbs collection. The default level is Info ($level = BreadcrumbLevel::Info).
breadcrumbs->add($message, $category, $dateTime, $level, $event)
Adds a new breadcrumb to the breadcrumbs collection. The default event is Manual ($event = "manual").
breadcrumbs->add($message, $category, $dateTime, $level, $event, $className)
Adds a new breadcrumb to the breadcrumbs collection. The default class name is an empty string ($className = "").
breadcrumbs->add($message, $category, $dateTime, $level, $event, $className, $methodName)
Adds a new breadcrumb to the breadcrumbs collection. The default method name is an empty string ($methodName = "").
breadcrumbs->add($message, $category, $dateTime, $level, $event, $className, $methodName, $line)
Adds a new breadcrumb to the breadcrumbs collection. The default line number is 0 ($line = 0).
breadcrumbs->add($message, $category, $dateTime, $level, $event, $className, $methodName, $line, $customData)
Adds a new breadcrumb to the breadcrumbs collection. The default custom data number is empty ($customData = null).
breadcrumbs->get()
Gets all collected breadcrumbs.
breadcrumbs->clear()
Clears collected breadcrumbs.
Callbacks
set_can_report_exception_callback(callable $canReportExceptionHandler)
Occurs between generating a new crash report and calling the $beforeReportExceptionHandler.
The set_can_report_exception_callback event occurs right after a new report is generated and ready to be sent to the Logify Alert service. Handle this event by returning false from your function to cancel sending the report. Thus, the generated report is not sent to the service and the *set_before_report_exception_callback is not raised.
set_before_report_exception_callback(callable $beforeReportExceptionHandler)
Occurs before Logify Alert sends a new crash report to the service.
The set_before_report_exception_callback event occurs between the set_can_report_exception_callback event and sending a new report to the Logify Alert service. If sending the report is canceled in the set_can_report_exception_callback event's handler, the report is not sent and the set_before_report_exception_callback event is not raised. Use the set_can_report_exception_callback event's handler to add custom data or an attachment to the sent report by assigning the required data to the customData or attachments property.
set_after_report_exception_callback(callable $afterReportExceptionHandler)
Occurs after Logify Alert sends a new crash report to the service. The $afterReportExceptionHandler's $response parameter is true if the report has been sent successfully. Otherwise, the $response parameter contains the error message that occurred during sending.
Custom Clients
You can create a custom client if the described one is not suitable. Refer to the Custom Clients document for more information.