Download the PHP package justawebdev/laravel-simple-analytics without Composer
On this page you can find all versions of the php package justawebdev/laravel-simple-analytics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download justawebdev/laravel-simple-analytics
More information about justawebdev/laravel-simple-analytics
Files in justawebdev/laravel-simple-analytics
Package laravel-simple-analytics
Short Description Lightweight server-side analytics for Laravel
License
Informations about the package laravel-simple-analytics
Laravel Simple Analytics
A lightweight, server-side analytics package for Laravel applications. Track page views, custom events, and generate simple reports without relying on third-party services.
✨ Features
- 🚀 Zero Dependencies - Pure Laravel implementation
- 📊 Page View Tracking - Automatic middleware-based tracking
- 🎯 Custom Events - Track any event with metadata
- 🛡️ Route Filtering - Ignore specific routes (like admin panels)
- 📈 Simple Reports - Built-in console command for top pages
- 🎨 Facade & Helpers - Easy-to-use API
- ⚡ Performance Focused - Minimal overhead
📦 Installation
Install the package via Composer:
Publish the configuration file:
Run the migration to create the analytics table:
⚙️ Configuration
After publishing, you'll find the config file at config/analytics.php. Here's what you can configure:
🚀 Usage
Automatic Page View Tracking
Add the middleware to your app/Http/Kernel.php or route group:
Manual Event Tracking
Use the facade to track custom events:
Using the Helper Function
Getting Analytics Data
Console Reports
Generate a quick report from the command line:
Output:
🔧 Advanced Usage
Custom Middleware Implementation
If you need more control, you can create your own middleware:
Database Schema
The package creates an analytics_events table with these columns:
id- Primary keytype- Event type (pageview, event)name- Event name or page pathmeta- JSON metadata (nullable)method- HTTP method (nullable)status- HTTP status code (nullable)duration_ms- Response time in milliseconds (nullable)created_at/updated_at- Timestamps
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
📄 License
This package is open-sourced software licensed under the MIT license.
🙏 Credits
- Justin Thomas - Creator
- Laravel Community - Inspiration
Made with ❤️ for the Laravel community