How tochix/smetrics works
Project type and purpose
• This is an open-source CLI tool (PHP 7.1+) installed and run via Composer.
• It generates “SMetrics” statistics based on users’ posts by calling an external HTTP API, processing the JSON response, mapping it into domain models, and presenting summary stats.
File structure
• Top-level
• index.php – CLI entry point
• composer.json/lock, LICENSE, README.md
• src/Config – configuration loader (AbstractConfig, SMetricsConfig)
• src/Api
• Api/SMetrics – core SMetrics client classes (SMetricsApi, SMetricsFacade, SMetricsStats, Locator)
• Api/Http – HTTP-layer abstractions (RequestInterface, Request, ResponseInterface, ResponseFactory) and exceptions
• Api/SMetrics/Model – domain model factory, Post model & interface
• Exceptions are namespaced per subsystem (Config, Http, SMetrics).
• No UI or database—just CLI, config file, HTTP calls, in-memory objects.
README for additional insights
• Usage: php index.php
• Config file under src/Config/smetrics.php