PHPackages                             4apps/api-stats-php - 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. [API Development](/categories/api)
4. /
5. 4apps/api-stats-php

ActiveProject[API Development](/categories/api)

4apps/api-stats-php
===================

PHP library for Api stats portal

00[1 issues](https://github.com/4Apps/api-stats-php/issues)PHP

Since Apr 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/4Apps/api-stats-php)[ Packagist](https://packagist.org/packages/4apps/api-stats-php)[ RSS](/packages/4apps-api-stats-php/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP library for [Api Stats Portal](https://github.com/4Apps/api-stats-portal)
=============================================================================

[](#php-library-for-api-stats-portal)

Installation / Usage
--------------------

[](#installation--usage)

Installation via composer: `composer require 4apps/api-stats-php`

Usage example (for php 8.1+):

```
use 4Apps\ApiStats;

$mongoDbConfig = [
    'string' => 'mongodb://mongodb:27017',
    'dbname' => 'apiStatistics'
];
$apiStats = ApiStats($mongoDbConfig);

// Create event
$eventId = $apiStats->logApiStatistics($scope, $service, $contextName, $methodName, $endpointUrl);

// Failed
$apiStats->updateApiStatistics($eventId, failed: true);

// Retry
$seconds = 60; // Retry timeout
$apiStats->updateApiStatistics($eventId, retry: true, retrySeconds: $seconds);

// Success
$apiStats->updateApiStatistics($eventId);

// Custom timestamp
$apiStats->updateApiStatistics($eventId, timestamp: time());
```

Development
-----------

[](#development)

To make changes to the library do this:

1. `python3 -m pip install -r requirements.txt`
2. `fab docker.install`
3. `docker compose exec develop bash`
4. Repository contains configuration files for vscode container extension.

Testing
-------

[](#testing)

To run phpunit tests, bring up development docker machine and run phpunit: `./vendor/bin/phpunit`

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4aeddb606d1da2a41f4d0b769bad1c33e5e2c14b24b1014e64cd98d45f5f4dc?d=identicon)[gintsmurans](/maintainers/gintsmurans)

---

Top Contributors

[![gintsmurans](https://avatars.githubusercontent.com/u/56369?v=4)](https://github.com/gintsmurans "gintsmurans (5 commits)")

### Embed Badge

![Health badge](/badges/4apps-api-stats-php/health.svg)

```
[![Health](https://phpackages.com/badges/4apps-api-stats-php/health.svg)](https://phpackages.com/packages/4apps-api-stats-php)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k14](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
