PHPackages                             utopia-php/usage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. utopia-php/usage

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

utopia-php/usage
================

Light and Fast Usage library

0.1.0(3w ago)0259[2 PRs](https://github.com/utopia-php/usage/pulls)MITPHPPHP &gt;=8.0

Since Mar 11Pushed 1w agoCompare

[ Source](https://github.com/utopia-php/usage)[ Packagist](https://packagist.org/packages/utopia-php/usage)[ RSS](/packages/utopia-php-usage/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (7)Versions (6)Used By (0)

Utopia Usage
============

[](#utopia-usage)

[![Total Downloads](https://camo.githubusercontent.com/5d17aa5e59971d7f555552faf204297b552aba674a7129be3cddc1cab59bbf0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75746f7069612d7068702f75736167652e737667)](https://camo.githubusercontent.com/5d17aa5e59971d7f555552faf204297b552aba674a7129be3cddc1cab59bbf0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f75746f7069612d7068702f75736167652e737667)[![Discord](https://camo.githubusercontent.com/b130cc39f0cd917f3fc3e9f94c08a8ba302c8b36d32d8914f5494c473a7070e6/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f353634313630373330383435313531323434)](https://appwrite.io/discord)

Utopia framework usage library is a simple and lite library for managing application usage statistics. This library is aiming to be as simple and easy to learn and use. This library is maintained by the [Appwrite team](https://appwrite.io).

Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project it is dependency free and can be used as standalone with any other PHP project or framework.

Features
--------

[](#features)

- **Two Table Architecture**: Separate events and gauges tables optimized for their access patterns
- **Events Table**: Request-level metrics with dedicated columns (path, method, status, resource, country, userAgent)
- **Gauges Table**: Simple resource snapshots (storage size, user count, etc.)
- **Query-Time Aggregation**: No write-time period fan-out — aggregate by any interval at query time
- **Daily Materialized View**: Pre-aggregated daily SummingMergeTree for fast billing queries
- **Pluggable Adapters**: ClickHouse (production) and Database (development/testing)
- **In-Memory Buffering**: Collect metrics and flush in batch for high-throughput scenarios
- **Rich Queries**: Filter, sort, paginate using `Utopia\Query\Query` objects
- **Multi-Tenant**: Shared tables with tenant isolation via string tenant IDs
- **LowCardinality Columns**: Country uses `LowCardinality(String)` for efficient storage
- **Bloom Filter Indexes**: Fast filtering on all event columns

Getting Started
---------------

[](#getting-started)

Install using composer:

```
composer require utopia-php/usage
```

### Using ClickHouse Adapter

[](#using-clickhouse-adapter)

```
