arcana / laravel-pulse-s3-metrics
Fetch existing data usage and storage metrics from AWS CloudWatch for your S3 bucket and display them in your Laravel Pulse dashboard.
Fund package maintenance!
arcana-softworks
Installs: 1 557
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 2
Requires
- php: ^8.1
- aws/aws-sdk-php: ^3.0
- illuminate/contracts: ^10.0
- laravel/pulse: ^1.0@beta
- livewire/livewire: ^3.2
- spatie/laravel-package-tools: ^1.16.1
Requires (Dev)
- larastan/larastan: ^2.7.0
- laravel/pint: ^1.13.7
- nunomaduro/collision: ^7.10
- orchestra/testbench: ^8.18
- pestphp/pest: ^2.30
- pestphp/pest-plugin-arch: ^2.5
- pestphp/pest-plugin-laravel: ^2.2
- pestphp/pest-plugin-livewire: ^2.1
- phpstan/extension-installer: ^1.3.1
- phpstan/phpstan-deprecation-rules: ^1.1.4
- phpstan/phpstan-phpunit: ^1.3.15
- spatie/laravel-ray: ^1.33
This package is auto-updated.
Last update: 2024-11-08 15:45:45 UTC
README
S3 Metrics Card for Laravel Pulse
Fetch existing data usage and storage metrics from AWS CloudWatch for your S3 buckets and display them in a card on your Laravel Pulse dashboard.
Hire us
Developers at Arcana Softworks have been building business-class PHP applications for more than 10 years. Learn more about what we can do for you or your business.
Installation
You can install the package via composer:
composer require arcana/laravel-pulse-s3-metrics
You can optionally publish the config file with:
php artisan vendor:publish --tag="laravel-pulse-s3-metrics-config"
This is the contents of the published config file:
return [ 'enabled' => env('PULSE_S3_METRICS_ENABLED', true), 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'class' => env('AWS_STORAGE_CLASS', 'StandardStorage'), ];
By default, this package will fetch metrics for the S3 bucket specified in your AWS_BUCKET
environment variable. You can override this by setting the bucket
config value.
One variable you may be missing is the AWS_STORAGE_CLASS
variable, which has been introduced by this package. This should be set to the storage class of your S3 bucket. The default value is StandardStorage
, which is the default storage class for S3 buckets. If you have a different storage class, you should set this variable to the appropriate value.
The region should be the region where your S3 metrics are stored on CloudWatch.
Install the Recorder
Publish the Laravel Pulse config so that you may add the S3 Metrics recorder:
php artisan vendor:publish --tag=pulse-config
This will publish the Pulse config to config/pulse.php
Add the S3 Metrics recorder to the recorders
section of the Pulse config:
'recorders' => [ // Existing recorders... // ... \Arcana\PulseS3Metrics\Recorders\S3Metrics::class => [ 'enabled' => env('PULSE_S3_METRICS_ENABLED', true), ], ],
Add the card to your Laravel Pulse dashboard
Publish the Laravel Pulse dashboard view:
php artisan vendor:publish --tag=pulse-dashboard
This will publish the Pulse dashboard view to resources/views/vendor/pulse/dashboard.blade.php
Add the S3 Metrics card to your dashboard (the card looks best at full width):
<x-pulse> <livewire:pulse-s3-metrics cols="full" /> {{-- Existing cards... --}} </x-pulse>
Usage
The S3 Metrics card may not show metrics from your S3 bucket immediately. It may take up to 24 hours for metrics to be available on CloudWatch.
The recorder will run periodically whilst php artisan pulse:work
is running. You can run this command in a terminal window to start the recorder:
php artisan pulse:check
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.