Download the PHP package webhubworks/inertia-props-stats without Composer
On this page you can find all versions of the php package webhubworks/inertia-props-stats. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webhubworks/inertia-props-stats
More information about webhubworks/inertia-props-stats
Files in webhubworks/inertia-props-stats
Package inertia-props-stats
Short Description Measures the size of InertiaJS props and provides statistics about them.
License MIT
Homepage https://github.com/webhubworks/inertia-props-stats
Informations about the package inertia-props-stats
Inertia Props Stats
A Laravel package that measures the size of InertiaJS props and provides statistics about them. This tool helps you monitor and optimize your Inertia payloads during development.
What it does
This package:
- Measures payload size: Automatically calculates the total size of your Inertia props in KB
- Warns about large payloads: Displays console warnings and an expandable stats panel when props exceed the configured threshold
- Detects duplicate keys: Identifies when the same key is used in both shared and page props
- Development-only: Only collects stats in non-production environments to avoid unnecessary overhead
- Configurable exceptions: Control when exceptions are thrown for duplicate keys or size violations
- Flare integration: Optionally reports large payloads to Spatie Flare for monitoring
- Ray integration: Sends payload statistics to Ray for debugging
The package provides detailed statistics including:
- Total payload size (shared + page props)
- Component-specific props size
- Configured threshold
- Amount exceeded (if applicable)
- Duplicate keys between shared and page props
Installation
Install the package via Composer:
Publish the configuration file (optional):
This will create a config/inertia-props-stats.php file where you can customize:
Configuration options:
enabled: Enable/disable stats collection globally (disabled in production by default)payload_size.threshold_in_kb: Size threshold in KB before warnings are shownthrow_exception.on_duplicate_keys: Throw an exception when duplicate keys are detected in shared and page propsthrow_exception.when_component_props_size_exceed_total_props_size: Throw an exception when component props exceed total props size
Recommended thresholds:
- Soft limit: 100-200KB
- Hard limit: 500KB
Vue.js Component
An example Vue.js component is included in resources/js/components/InertiaPropsStatsPanel.vue that you can copy and paste into your main app.
This component:
- Monitors the
_inertiaPayloadTotalSizeInKbprop - Displays an expandable stats panel when the payload exceeds the threshold
- Shows detailed payload statistics including size, threshold, and duplicate keys
- Provides a cleaner UI for development environments with more detailed error messages
To use it, copy the component to your Vue.js application and include it in your main layout:
Note: The component requires lucide-vue-next for icons. Install it with:
License
The MIT License (MIT). Please see the license file for more information.
All versions of inertia-props-stats with dependencies
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
inertiajs/inertia-laravel Version ^2.0||^3.0
spatie/laravel-package-tools Version ^1.16