Skip to content

Commit c83d675

Browse files
authored
Merge pull request #18 from still-code/umami-v2
Umami v2
2 parents 02111c4 + d7fee08 commit c83d675

File tree

8 files changed

+255
-224
lines changed

8 files changed

+255
-224
lines changed

README.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
API wrapper for umami website analytics. get your statistics in the laravel app.
1515

16-
check out [Umami](https://umami.is/) own your website analytics
16+
check out [Umami](https://umami.is/), own your website analytics
1717

1818
## Features
1919

2020
- Manage websites
21-
- Manage accounts
21+
- Manage users
2222
- query statistics stats, page views, events and metrics
2323

2424
## Installation
@@ -28,6 +28,12 @@ You can install the package via composer:
2828
```bash
2929
composer require still-code/laravel-umami
3030
```
31+
32+
#### Umami version:
33+
34+
- for umami v1 use v4
35+
- for umami v2 use v5
36+
3137
### Config
3238
to publish the configuration file:
3339

@@ -75,7 +81,7 @@ required: site id from umami server
7581

7682
required: the stats part you want to get from umami,
7783

78-
available options : `stats, pageviews, events, metrics`
84+
available options : `active, stats, pageviews, events, metrics`
7985

8086
default: `stats`
8187

@@ -85,7 +91,7 @@ default: `stats`
8591

8692
### Options for Query Stats
8793

88-
#### Dates (start_at,end_at)
94+
#### Dates (startAt,endAt)
8995

9096
optional: Timestamp of starting and end date,
9197

@@ -95,8 +101,8 @@ you can pass `carbon` object or timestamp in milliseconds
95101

96102
```php
97103
\Umami\Umami::query(siteID,'metrics',[
98-
'start_at'=>today()->subDays(7),
99-
'end_at'=>today(),
104+
'startAt'=>today()->subDays(7),
105+
'endAt'=>now(),
100106
]);
101107
```
102108

@@ -153,18 +159,29 @@ default: url
153159
```php
154160
\Umami\Umami::createWebsite([
155161
'domain'=>'domain.ltd',
156-
'name'=>'account name',
157-
'userId'=>'3', // account id
162+
'name'=>'user name',
163+
]);
164+
```
165+
166+
#### create a website for a diffrent user
167+
if you want to create a website for different user then the admin user defined in the config, you need to provide the authentication for that user.
168+
this is helpfully when creating a new user with a website
169+
170+
```php
171+
\Umami\Umami::createWebsite([
172+
'domain' => 'domain.ltd',
173+
'name' => 'user name',
174+
],[
175+
'username' => 'otherUserName',
176+
'password' => 'otherPassword',
158177
]);
159178
```
160179

161180
### Update a website
162181

163182
```php
164-
\Umami\Umami::websites('d131d2ae-5d21-4a54-80ba-16719afedf7b',[
165-
'domain'=>'domain.ltd',
166-
'name'=>'account name',
167-
'userId'=>'3', // account id
183+
\Umami\Umami::updateWebsites('d131d2ae-5d21-4a54-80ba-16719afedf7b',[
184+
'name'=>'user name',
168185
]);
169186
```
170187

@@ -174,33 +191,33 @@ default: url
174191
\Umami\Umami::deleteWebsite('d131d2ae-5d21-4a54-80ba-16719afedf7b');
175192
```
176193

177-
## Accounts
194+
## Users
178195

179-
### Get All accounts
196+
### Get All users
180197

181198
```php
182-
\Umami\Umami::accounts();
199+
\Umami\Umami::users();
183200
```
184201

185-
### Create an account
202+
### Create a user
186203

187204
```php
188-
\Umami\Umami::createAccount('username','password');
205+
\Umami\Umami::createUser('username','password');
189206
```
190207

191-
### Update an account
208+
### Update a user
192209

193210
```php
194-
\Umami\Umami::updateAccount(1,[
211+
\Umami\Umami::updateUser(1,[
195212
'username'=>'username',
196213
'password'=>'password',
197214
]);
198215
```
199216

200-
### Delete an account
217+
### Delete an user
201218

202219
```php
203-
\Umami\Umami::deleteAccounts(2);
220+
\Umami\Umami::deleteUser(2);
204221
```
205222

206223
## More details

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
4949
},
5050
"config": {
51-
"sort-packages": true
51+
"sort-packages": true,
52+
"allow-plugins": {
53+
"pestphp/pest-plugin": true
54+
}
5255
},
5356
"extra": {
5457
"laravel": {

0 commit comments

Comments
 (0)