{"id":22823303,"url":"https://github.com/rvxlab/laravel-analytics","last_synced_at":"2026-01-15T22:15:18.321Z","repository":{"id":249545621,"uuid":"830792094","full_name":"RVxLab/laravel-analytics","owner":"RVxLab","description":"Simple, lightweight analytics for Laravel","archived":false,"fork":false,"pushed_at":"2024-08-03T13:11:54.000Z","size":28,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T16:27:40.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RVxLab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-19T02:32:33.000Z","updated_at":"2024-08-03T13:11:31.000Z","dependencies_parsed_at":"2025-04-02T17:44:11.420Z","dependency_job_id":"4c768261-b115-48f1-8449-6f102ffcb8a7","html_url":"https://github.com/RVxLab/laravel-analytics","commit_stats":null,"previous_names":["rvxlab/laravel-analytics"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/RVxLab/laravel-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RVxLab%2Flaravel-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RVxLab%2Flaravel-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RVxLab%2Flaravel-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RVxLab%2Flaravel-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RVxLab","download_url":"https://codeload.github.com/RVxLab/laravel-analytics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RVxLab%2Flaravel-analytics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28472624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:13:38.078Z","status":"ssl_error","status_checked_at":"2026-01-15T22:12:11.737Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-12T16:16:16.174Z","updated_at":"2026-01-15T22:15:18.306Z","avatar_url":"https://github.com/RVxLab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Analytics\n\n\u003e 🚧 This package is still a work in progress\n\nA simple, extremely lightweight analytics package.\n\n## Requirements\n\n- Laravel 10+\n\n## Installation\n\nInstall using Composer:\n\n```shell\ncomposer require rvxlab/laravel-analytics\n```\n\nPublish and run the migrations:\n\n```shell\nphp artisan vendor:publish --tag=\"analytics-migrations\"\n\nphp artisan migrate\n```\n\n**Optional**: Publish the config file:\n\n```shell\nphp artisan vendor:publish --tag=\"analytics-config\"\n```\n\n## Setting up\n\nThere are 2 ways of setting up analytics:\n\n1. Globally\n2. In a route group\n\n### Globally (Laravel 11)\n\nAdd the `RVxLab\\Analytics\\Middleware\\RecordPageView` middleware by calling `append` or `appendToGroup` on the `Illuminate\\Foundation\\Configuration\\Middlewares` parameter of the `withMiddleware` call:\n\n```php\nuse Illuminate\\Foundation\\Application;\nuse Illuminate\\Foundation\\Configuration\\Middleware;\nuse RVxLab\\Analytics\\Middleware\\RecordPageView;\n\nreturn Application::configure(basePath: dirname(__DIR__))\n    -\u003ewithMiddleware(function (Middleware $middleware) {\n        $middleware-\u003eappend([RecordPageView::class]);\n        // OR\n        $middleware-\u003eappendToGroup('\u003cmiddlewareGroup\u003e', [RecordPageView::class]);\n    })-\u003ecreate();\n```\n\n### Globally (Laravel 10 and 11 without the new slim skeleton)\n\nAdd the `RVxLab\\Analytics\\Middleware\\RecordPageView` middleware to the end of your `middleware` array or the relevant group in your `middlewareGroups` array of your `App\\Http\\Kernel`:\n\n```php\nnamespace App\\Http;\n\nuse RVxLab\\Analytics\\Middleware\\RecordPageView;\n\nclass Kernel \n{\n    protected $middleware = [\n        // --snip--\n        RecordPageView::class,\n    ];\n\n    protected $middlewareGroups = [\n        'web' =\u003e [\n            // --snip--\n            RecordPageView::class,\n        ],\n    ];\n}\n```\n\n### Per route\n\nYou can add the `RVxLab\\Analytics\\Middleware\\RecordPageView` middleware to a single route or to a group of routes:\n\n```php\nuse App\\Http\\Controllers\\HomeController;\nuse RVxLab\\Analytics\\Middleware\\RecordPageView;\n\nRoute::get('/', HomeController::class)-\u003emiddleware([RecordPageView::class]);\n\n// OR\n\nRoute::middleware([RecordPageView::class])-\u003egroup(function () {\n    Route::get('/', HomeController::class);\n});\n```\n\n### Dealing with proxies\n\nIf your application is behind a proxy, make sure that proxy is defined in the trusted proxies.\n\nNot doing so will cause the address in your analytics to always be `127.0.0.1`.\n\nFor example, if you use a simple site provisioned through Laravel Forge, you will want to add `'127.0.0.1'` to your trusted proxies. If you're behind a load balance through AWS or go through CloudFlare, you may not know what IP the request will come from. In that case, just add `'*'` to your trusted proxies.\n\nSee [the Laravel documentation on trusted proxies](https://laravel.com/docs/11.x/requests#configuring-trusted-proxies) for more information.\n\n## Using a separate database\n\nIf you wish to use a separate database for analytics, add an `ANALYTICS_DB_CONNECTION` environment variable and set it to the connection you want to use. Make sure it exists in your `config/database.php` file.\n\n## Changelog\n\nPlease see the [Changelog](./CHANGELOG.md) for more information on what has changed recently.\n\n## License\n\nThe MIT License (MIT). Please see the [License File](./LICENSE.md) for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvxlab%2Flaravel-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvxlab%2Flaravel-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvxlab%2Flaravel-analytics/lists"}