PHP code example of atm-code / laravel-umami

1. Go to this page and download the library: Download atm-code/laravel-umami 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/ */

    

atm-code / laravel-umami example snippets


\Umami\Umami::query('example-site-id', 'metrics', [
    'start_at'=>today()->subDays(7),
    'end_at'=>today(),
    'type'=>'referrer',
]);

\Umami\Umami::query(siteID: 1, force: true)

\Umami\Umami::query('example-site-id');

\Umami\Umami::query('example-site-id','pageviews');

\Umami\Umami::query('example-site-id','metrics',[
    'start_at'=>today()->subDays(7),
    'end_at'=>now(),
]);

\Umami\Umami::query('example-site-id','metrics',[
    'unit'=>'year',
]);

\Umami\Umami::query('example-site-id','metrics',[
    'tz'=>'America/Los_Angeles',
]);

\Umami\Umami::query('example-site-id','metrics',[
    'tz'=>'America/Los_Angeles',
]);

\Umami\Umami::websites();

\Umami\Umami::createWebsite([
    'domain'=>'domain.ltd',
    'name'=>'user name',
]);

\Umami\Umami::createWebsite([
    'domain' => 'domain.ltd',
    'name' => 'user name',
],[
    'username' => 'otherUserName',
    'password' => 'otherPassword',
]);

\Umami\Umami::updateWebsites('example-site-id',[
    'name'=>'user name',
]);

\Umami\Umami::deleteWebsite('example-site-id');

\Umami\Umami::events('example-site-id', [
    'start_at'=>today()->subDays(7),
    'end_at'=>now(),
    'event' => 'custom_event',
]);

\Umami\Umami::event_fields('example-site-id', [
    'start_at'=>today()->subDays(7),
    'end_at'=>now(),
]);

\Umami\Umami::users();

\Umami\Umami::createUser('username','password');

\Umami\Umami::updateUser(1,[
    'username'=>'username',
    'password'=>'password',
]);

\Umami\Umami::deleteUser(2);
bash
php artisan vendor:publish --provider="Umami\UmamiServiceProvider"