GithubHelp home page GithubHelp logo

devdavido / laravel-reporto Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 1.0 48 KB

Report browser errors to the server with the W3C Reporting API

License: MIT License

PHP 100.00%
laravel report-api browser frontend csp deprecations browser-interventions feature-policy network-error crash-report csp-violation backend

laravel-reporto's Introduction

Reporto: Report browser errors to the server

Latest Version Build Status Code Coverage Total Downloads

This package makes use of the W3C Reporting API and provides an easy plug-and-play package for your existing project. It will automatically add the necessary Report HTTP headers and log all configured browser errors to your Laravel backend.

Documentation

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving this package? Feel free to create an issue on GitHub, we'll try to address it as soon as possible.

If you've found a bug regarding security please mail github{at}diskoboss{døt}de instead of using the issue tracker.

Minimum requirements

  • PHP 8.0+
  • Laravel 9+

For support of older PHP / Laravel versions, check out previous releases of this package.

Installation

You can install this package via composer using this command:

composer require devdavido/laravel-reporto

The package will automatically register itself and add a Report-To header to your web routes. Each error or violation will be logged to the backend.

You can publish the config-file with:

php artisan vendor:publish --provider="DevDavido\Reporto\ReportoServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    /*
     * Use this setting to enable the reporting API header
     */
    'enabled' => env('REPORTING_API_ENABLED', true),

    /*
     * Enables the reporting API for all subdomains
     */
    'include_subdomains' => env('REPORTING_API_INCLUDE_SUBDOMAINS', false),

    /*
     * Exclude certain source files from being logged
     */
    'exclude_source_files' => env('REPORTING_API_EXCLUDE_SOURCE_FILES', ['chrome-extension://*']),

    /*
     * Defines cached lifetime of all endpoint in seconds (86400s = 1 day)
     */
    'endpoint_max_age' => env('REPORTING_API_MAX_AGE', 86400),

    /*
     * Which types of browser errors to report
     * @see https://w3c.github.io/reporting/
     */
    'groups' => [
        'default',
        'csp-endpoint',
        'network-errors'
    ],

    /*
     * If you want to set the logging route prefix
     */
    'route_prefix' => 'log'
];

Support me

If you installed the package and it was useful for you or your business, please don't hesitate to make a donation (as I am a student). Thank you!

Buy me a coffee

Testing

You can run the tests with:

vendor/bin/phpunit

Ideas / ToDo

  • Daily/weekly reports via email
  • Multiple endpoints
  • More unit tests

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover any security related issues, please email github{at}diskoboss{døt}de instead of using the issue tracker.

Credits

License

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

laravel-reporto's People

Contributors

dependabot[bot] avatar devdavido avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fhferreira

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.