PHP code example of aldeebhasan / laravel-event-tracker

1. Go to this page and download the library: Download aldeebhasan/laravel-event-tracker 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/ */

    

aldeebhasan / laravel-event-tracker example snippets


track_event(event:"event name",context: [],user: auth()->user())

tracker('database')->track_event(event:"event name",context: [],user: auth()->user())

\Aldeebhasan\LaravelEventTracker\Facades\EventTracker::driver()->track_event("event name");

php artisan event-tracker:command --from=   //  Start date (YYYY-MM-DD) and by default is yesterday
                                  --to=     //  End date (YYYY-MM-DD) and by default is today
                                  --event=  //  Specific event name to filter on
                                  --user_id=// Specific user id to filter on     

    'drivers' => [
        /*'database' => [
            'table' => 'events',
            'connection' => 'mysql',
        ],*/
         'custom' => [
            'implementation' => YourProject\Trackers\CustomTracker::class,
            'api-key' => '***********',
            'project' => '***********',
        ],
    ],

  tracker('custom')->track_event('action.created');

class HostResolver implements ResolveUI
{
    public static function resolve(EventTracker $tracker): string
    {
        return $tracker->preloadedResolverData['host'] ?? (request()->getHost() ?? '');
    }
}
bash
php artisan vendor:publish --tag="event-tracker-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="event-tracker-config"