PHP code example of nowendwell / app-analytics

1. Go to this page and download the library: Download nowendwell/app-analytics library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nowendwell / app-analytics example snippets


protected $middlewareGroups = [
    'web' => [
        // ...
        \Nowendwell\AppAnalytics\Middleware\TrackAnalyticsMiddleware::class,
    ],

use Nowendwell\AppAnalytics\Facades\AppAnalytics;

class InvoicePaymentController extends Controller
{
    public function store(Invoice $invoice): RedirectResponse
    {
        // Track a custom event
        AppAnalytics::event('Invoice Paid', ['invoice_id' => 123, 'amount' => 1000]);

        return response()->redirect(route('invoices.show', $invoice));
    }
}
bash
php artisan vendor:publish --tag="app-analytics-config"
bash
php artisan vendor:publish --tag="app-analytics-migrations"
php artisan migrate