diff options
author | Frankie B <git@diskfloppy.me> | 2024-06-19 15:15:35 +0100 |
---|---|---|
committer | Frankie B <git@diskfloppy.me> | 2024-06-19 15:15:35 +0100 |
commit | 8f02ed0a76ce021d9877f28793aa0ebff2b88e8c (patch) | |
tree | 622fd42be95b42817b38ee9e11eb6c0509c1c955 | |
parent | 02c68f854589e63ba4ee1d5a8732ba9be25ceb6a (diff) |
Remove posthog pageview middleware
-rw-r--r-- | .env.example | 3 | ||||
-rw-r--r-- | app/Http/Middleware/PageView.php | 28 | ||||
-rw-r--r-- | app/Providers/AppServiceProvider.php | 9 | ||||
-rw-r--r-- | composer.json | 1 | ||||
-rw-r--r-- | composer.lock | 56 | ||||
-rw-r--r-- | config/services.php | 5 | ||||
-rw-r--r-- | routes/web.php | 18 |
7 files changed, 10 insertions, 110 deletions
diff --git a/.env.example b/.env.example index d2e73e2..72dbf35 100644 --- a/.env.example +++ b/.env.example @@ -26,6 +26,3 @@ MEMCACHED_HOST=127.0.0.1 LASTFM_KEY= LASTFM_USER= - -POSTHOG_KEY= -POSTHOG_HOST= diff --git a/app/Http/Middleware/PageView.php b/app/Http/Middleware/PageView.php deleted file mode 100644 index dda0662..0000000 --- a/app/Http/Middleware/PageView.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -namespace App\Http\Middleware; - -use Closure; -use Illuminate\Http\Request; -use PostHog\PostHog; -use Symfony\Component\HttpFoundation\Response; - -class PageView -{ - /** - * Handle an incoming request. - * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next - */ - public function handle(Request $request, Closure $next): Response - { - PostHog::capture([ - 'distinctId' => request()->ip(), - 'event' => '$pageview', - 'properties' => array( - '$current_url' => url()->current(), - ), - ]); - return $next($request); - } -} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 3aa155c..2209133 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -17,12 +17,5 @@ class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. */ - public function boot(): void { - PostHog::init( - Config::get('services.posthog.key'), - [ - 'host' => 'https://'.Config::get('services.posthog.host') - ] - ); - } + public function boot(): void {} } diff --git a/composer.json b/composer.json index 0a21ccb..315bb81 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,6 @@ "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.10", "laravel/tinker": "^2.8", - "posthog/posthog-php": "^3.3", "scrivo/highlight.php": "v9.18.1.10", "sentry/sentry-laravel": "^4.1", "spatie/laravel-honeypot": "^4.3", diff --git a/composer.lock b/composer.lock index fb73243..8571ff1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3204be06a1b7a37cc0af50a0babca0a0", + "content-hash": "28176864af13fa0e06f1784e6e64e791", "packages": [ { "name": "auth0/auth0-php", @@ -3042,60 +3042,6 @@ "time": "2023-11-12T21:59:55+00:00" }, { - "name": "posthog/posthog-php", - "version": "3.3.2", - "source": { - "type": "git", - "url": "https://github.com/PostHog/posthog-php.git", - "reference": "34301d0f20e20b785d465c574557278d18620f31" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PostHog/posthog-php/zipball/34301d0f20e20b785d465c574557278d18620f31", - "reference": "34301d0f20e20b785d465c574557278d18620f31", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=8.0" - }, - "require-dev": { - "overtrue/phplint": "^3.0", - "phpunit/phpunit": "^9.0", - "slope-it/clock-mock": "^0.4.0", - "squizlabs/php_codesniffer": "^3.7" - }, - "bin": [ - "bin/posthog" - ], - "type": "library", - "autoload": { - "psr-4": { - "PostHog\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PostHog <hey@posthog.com>", - "homepage": "https://posthog.com/" - } - ], - "description": "PostHog PHP Library", - "homepage": "https://github.com/PostHog/posthog-php", - "keywords": [ - "posthog" - ], - "support": { - "issues": "https://github.com/PostHog/posthog-php/issues", - "source": "https://github.com/PostHog/posthog-php/tree/3.3.2" - }, - "time": "2024-04-03T13:19:42+00:00" - }, - { "name": "psr-discovery/all", "version": "1.0.1", "source": { diff --git a/config/services.php b/config/services.php index a1cd7da..21e97c7 100644 --- a/config/services.php +++ b/config/services.php @@ -17,10 +17,5 @@ return [ 'lastfm' => [ 'key' => env('LASTFM_KEY'), 'user' => env('LASTFM_USER'), - ], - - 'posthog' => [ - 'key' => env('POSTHOG_KEY'), - 'host' => env('POSTHOG_HOST'), ] ]; diff --git a/routes/web.php b/routes/web.php index fb12e96..faef969 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,13 +3,13 @@ use App\Http\Controllers\AdminBookmarksController; use App\Http\Controllers\AdminGuestbookController; use App\Http\Controllers\AdminImportController; +use App\Http\Controllers\BlogController; use App\Http\Controllers\BookmarksController; use App\Http\Controllers\CalculatorsController; use App\Http\Controllers\ComputersController; use App\Http\Controllers\GuestbookController; use App\Http\Controllers\HomeController; use App\Http\Controllers\MusicController; -use App\Http\Middleware\PageView; use Illuminate\Support\Facades\Route; /* @@ -24,15 +24,13 @@ use Illuminate\Support\Facades\Route; */ // Run the PageView middleware for *all* public GET routes -Route::middleware(PageView::class)->group(function () { - Route::get('/', [HomeController::class, 'show']); - Route::get('/bookmarks', [BookmarksController::class, 'show']); - Route::get('/guestbook', [GuestbookController::class, 'show']); - Route::get('/calculators', [CalculatorsController::class, 'show']); - Route::get('/computers', [ComputersController::class, 'show']); - Route::get('/music', [MusicController::class, 'show']); -}); - +Route::get('/', [HomeController::class, 'show']); +Route::get('/bookmarks', [BookmarksController::class, 'show']); +Route::get('/blog', [BlogController::class, 'showPostList']); +Route::get('/guestbook', [GuestbookController::class, 'show']); +Route::get('/calculators', [CalculatorsController::class, 'show']); +Route::get('/computers', [ComputersController::class, 'show']); +Route::get('/music', [MusicController::class, 'show']); Route::post('/guestbook', [GuestbookController::class, 'addEntry']) ->middleware('rate_limit'); |