Pulse Api

Pulse Api stats

Downloads
2
Stars
1
Open Issues
0
Forks
0

View on GitHub →

Add an API layer to Laravel Pulse metrics

Access Laravel Pulse data using API

This package provides the very same information from Laravel Pulse as a JSON api endpoint.

Installation

You can install the package via composer:

composer require robertogallea/pulse-api

Usage

The package adds api endpoints to your application that exposes metrics collected by Pulse.

  • /api/pulse - Provides the full set of metrics collected by Pulse
  • /api/pulse/{$type} - Provides the metrics from a single type

By default, the available types are the one provided by Pulse itself:

  • servers
  • usage
  • queues
  • cache
  • slow_queries
  • exceptions
  • slow_requests
  • slow_jobs
  • slow_outgoing_requests

However, you can integrate your own by mimicking any Pulse card or by using your own implementation.

Configuration

The file config/pulse-api.php defines the configuration and can be customized after publishing the package Service Provider.

php artisan vendor:publish --tag=pulse-api-config

Access to endpoints

The endpoint is allowed according to the logic defined by the middlewares defined in the middleware section of the config. By default, the following apply:

'middleware' => [
'api',
Authorize::class, // the default Pulse middleware
],

Custom resources

Like in the web version of Pulse you can add your Cards, in PulseAPI you can add your own Resources, you can integrate the default ones by editing the resources configuration section:

'resources' =>
\Robertogallea\PulseApi\Services\PulseAPI::getDefaultResources()->merge([
// Add your custom resources
]),

Including recorders configuration in json response

Laravel Pulse cards use configuration to adjust the rendering of the card view. This may be not required or not useful in api but is enabled by default. You can disable the configuration exposure by proper setting of the include-config configuration key to false:

'include_config' => env('PULSE_API_INCLUDE_CONFIG', true),

Changelog

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

Credits

License

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

robertogallea photo

I am a PhD in computer science working at the University of Palermo, Italy. I am involved in all kinds of technical stuff, both software and hardware

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Robertogallea Pulse Api Related Articles

Access Laravel Pulse Data as a JSON API image

Access Laravel Pulse Data as a JSON API

Read article
Active Sessions Card for Laravel Pulse image

Active Sessions Card for Laravel Pulse

Read article
Validation Errors Card for Laravel Pulse image

Validation Errors Card for Laravel Pulse

Read article
Laravel 11 is now released! image

Laravel 11 is now released!

Read article
The Certification of Competence for Laravel logo

The Certification of Competence for Laravel

A community-driven, proctored assessment across 4 levels designed to validate real-world Laravel knowledge, from Junior to mastery-level Artisan. Official Vue.js, Official Nuxt, Angular, React, JS certifications also available.

The Certification of Competence for Laravel
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel
Honeybadger logo

Honeybadger

Simple developer-focused application monitoring for Laravel. Error tracking, log management, uptime monitoring, status pages, and more!

Honeybadger