Giter Site home page Giter Site logo

flare-client-php's Introduction

Send PHP errors to Flare

Latest Version on Packagist Run tests PHPStan Total Downloads

This repository contains the PHP client to send errors and exceptions to Flare. The client can be installed using composer and works for PHP 8.0 and above.

Using Laravel? You probably want to use Ignition for Laravel. It comes with a beautiful error page and has the Flare client built in.

Screenshot of error in Flare

Documentation

You can find the documentation of this package at the docs of Flare.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

flare-client-php's People

Contributors

adrianmrn avatar alexvanderbist avatar alissn avatar angeljqv avatar bobbypiper avatar driesvints avatar freekmurze avatar jellyfrog avatar jnoordsij avatar laravel-shift avatar maxgiting avatar nunomaduro avatar paolaruby avatar rubenvanassche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flare-client-php's Issues

Flare in WordPress project: all error levels sent to Flare and reported as `ErrorException`

After signing up for a trial with Flare I quickly hit the 1000 exception limit. Going through everything sent to Flare, I see that deprecation notices, warnings, and everything in between is being caught and sent to Flare as an ErrorException.

Examples

Attempting to access a non-existent array key without Flare shows the following error in my server's log file

PHP Warning: Undefined array key 1 in [...]/inc/template-functions.php on line 307

Called a the deprecated WordPress function get_page_by_title() shows the following error in my server's log file

PHP Deprecated: Function get_page_by_title() is <strong>deprecated</strong> since version 6.20! Use WP_Query instead.

Attempted solutions

Both of these are caught and reported by Flare as an instance of ErrorException. I've tried both the registerMiddleware() and filterReportsUsing() methods but they are both passed an instance of Spatie\FlareClient\Report which already shows the $exceptionClass property as being an instance of ErrorException.

Expected behaviour

I wouldn't expect warnings and deprecation notices to be cast into exceptions and sent to Flare.

Setup instructions on flareapp.io for "Other" PHP < 7.4 projects are not correct

This issue is related to setup instructions listed on flareapp.io. I was not really sure where to post this issue so I've posted it under this spatie/flare-client-php which seems to be the most appropriate public repo.

The setup instructions listed under a new Flare project for "Other" PHP projects that are running under PHP7.4 are wrong.

See screenshot:
SCR-20231201-kwkk

  1. The namespace does not contain backslashes
  2. The call to \Facade\FlareClient\Flare::make() triggers a Fatal error: Uncaught Error: Call to undefined method Facade\FlareClient\Flare::make()

I was able to find correct instructions in closed issue #14 of the facade/flare-client-php repo, which links to https://flareapp.io/blog/track-wordpress-errors-with-flare and shows the correct instructions:

use Facade\FlareClient\Flare;

Flare::register('YOUR-API-KEY')->registerFlareHandlers();

The instructions for other, < php7.4 projects listed on flareapp.io should probably be updated to the above correct instructions?

Add Carbon 3.0 support (or drop dependency altogether)

Carbon 3.0 will be released soon, possibly depending on the Laravel 11 release date (see laravel/framework#49764 (comment)). The master branch of Laravel has already been updated to allow for it; see laravel/framework#49764. The dev-master version of the Laravel skeleton, however, does not allow installation of v3.0 yet, as it clashes with the requirement listed in this package.

A possible solution to resolve this is by allowing ; however, on further inspection, I noticed the requirement was added in #15, but there seems to be no code using it whatsoever. Therefore I assume dropping it altogether is a better alternative.

flare error not shown

i try to run php artisan flare:test in production server but the error not shown in flare project dhashboard

How can I display a custom error page?

This is for a PHP but non-Laravel website I maintain. I've been able to register errors in Flare but I can't seem to get a custom error page displaying. The code below now displays the error page bit has stopped errors displaying in Flare.

Presumably set_exception_handler('myExceptionHandler'); overrides Flare?



$flare = Flare::make('meyuS2i1HKx4G98aSnpcTGgzrGo1NymA')  
	->registerFlareHandlers()
	->registerErrorHandler()
	->registerExceptionHandler();
	
 function myExceptionHandler($exception) {
	require 'error-page.php';  
 }
 
 set_exception_handler('myExceptionHandler');

[v1.4.0] report() in a blade view causes an infinite loop

It seems that calling report('....') inside a blade view file, causes flare-client-php to render again the view in:

$this->stacktrace->frames(),

this leads to this:

https://github.com/spatie/backtrace/blob/85d484be410674d68620bde530e5cb692f1260ff/src/Arguments/Reducers/StringableArgumentReducer.php#L19

that leads the View.php to trigger its ->toString() method and enter an infinite loop as it executes report('...') again

to reproduce the issue, just render this simple blade file:

//test.blade.php

@php
    report('failure');
@endphp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.