adanos / adanos-php
PHP SDK for the Adanos Market Sentiment API
Requires
- php: >=8.2
- guzzlehttp/guzzle: ^7.8
Requires (Dev)
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^10.5 || ^11.0
- squizlabs/php_codesniffer: ^3.10
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-13 14:15:03 UTC
README
PHP SDK for the Adanos Market Sentiment API.
Target API version: 1.54.0.
Install
composer require adanos/adanos-php
Quick Start
<?php use Adanos\AdanosClient; $client = new AdanosClient(apiKey: 'sk_live_...'); $trending = $client->reddit->trending(['limit' => 10]); $tsla = $client->reddit->stock('TSLA'); $health = $client->health(); echo $trending[0]['ticker'] . PHP_EOL; echo $tsla['buzz_score'] . PHP_EOL; echo $health['status'] . PHP_EOL;
Namespaces
$client->redditfor Reddit Stocks at/reddit/stocks/v1$client->newsfor News Stocks at/news/stocks/v1$client->xfor X/Twitter Stocks at/x/stocks/v1$client->polymarketfor Polymarket Stocks at/polymarket/stocks/v1$client->cryptofor Reddit Crypto at/reddit/crypto/v1$client->redditCryptoas an alias for$client->crypto$client->sentimentfor direct Finance Sentiment at/sentiment/v1$client->health()for aggregate API health
Examples
Reddit Stocks
$trending = $client->reddit->trending(['limit' => 10]); $sectors = $client->reddit->trendingSectors(['limit' => 10]); $countries = $client->reddit->trendingCountries(['limit' => 10]); $tsla = $client->reddit->stock('TSLA', ['from' => '2026-06-01', 'to' => '2026-06-07']); $mentions = $client->reddit->mentions('TSLA', ['limit' => 10, 'includeInherited' => true]); $explanation = $client->reddit->explain('TSLA'); $results = $client->reddit->search('Tesla', ['limit' => 10]); $comparison = $client->reddit->compare(['TSLA', 'AAPL', 'MSFT']); $market = $client->reddit->marketSentiment(); $stats = $client->reddit->stats(); $health = $client->reddit->health();
News
$trending = $client->news->trending(['source' => 'reuters']); $sectors = $client->news->trendingSectors(['source' => 'reuters']); $countries = $client->news->trendingCountries(['source' => 'reuters']); $nvda = $client->news->stock('NVDA'); $explanation = $client->news->explain('NVDA'); $results = $client->news->search('Nvidia', ['limit' => 10]); $comparison = $client->news->compare(['NVDA', 'AAPL']); $market = $client->news->marketSentiment(); $vod = $client->news->stock('VOD.L');
News accepts exchange-qualified tickers such as VOD.L. Use the ticker returned
by search or trending when calling stock, mentions, explain, or compare.
X/Twitter
$trending = $client->x->trending(['limit' => 20]); $nvda = $client->x->stock('NVDA'); $mentions = $client->x->mentions('NVDA', ['limit' => 10]); $comparison = $client->x->compare(['NVDA', 'AMD']); $market = $client->x->marketSentiment();
Polymarket
$trending = $client->polymarket->trending(['limit' => 20, 'type' => 'stock']); $aapl = $client->polymarket->stock('AAPL'); $results = $client->polymarket->search('Apple', ['limit' => 10]); $comparison = $client->polymarket->compare(['AAPL', 'TSLA']); $market = $client->polymarket->marketSentiment();
Polymarket stock responses can include a pulse block with a compact current interpretation and data-quality evidence. unique_traders can be null when retained wallet-level trades do not fully cover the requested window. Daily trend items expose bullish_pct and bearish_pct.
Across platforms, every trend_history value represents its own UTC calendar day. The final value for a live window describes the current partial UTC day and is not expected to equal the top-level period buzz_score.
Reddit Crypto
$trending = $client->crypto->trending(['limit' => 20]); $btc = $client->crypto->token('BTC'); $mentions = $client->crypto->mentions('BTC', [ 'from' => '2026-06-01', 'to' => '2026-06-07', 'limit' => 10, 'includeInherited' => true, ]); $results = $client->crypto->search('bitcoin', ['limit' => 10]); $comparison = $client->crypto->compare(['BTC', 'ETH']); $market = $client->crypto->marketSentiment();
Raw Crypto mention upvotes can be negative. Mention timestamps remain ISO 8601
UTC strings in the returned arrays.
Direct Finance Sentiment
/sentiment/v1/analyze requires a Professional account.
$analysis = $client->sentiment->analyze('TSLA looks like a short squeeze setup'); $apple = $client->sentiment->analyze('Goldman Sachs cuts Apple price target', target: 'Apple'); echo $analysis['sentiment_label'] . PHP_EOL; echo $analysis['sentiment_score'] . PHP_EOL;
The optional target selects the company to judge, by name or ticker. A company
name that appears in the text works best. Calls without a target still send only
text.
Responses are decoded arrays. components.model_score is a raw model score or
null; sentiment_score is the calibrated score. Engine 5.5 deprecates the older
VADER, RoBERTa, emoji, and phrase component fields but keeps them for compatibility.
Period Options
Use from and to as inclusive UTC dates for reproducible windows:
$client->reddit->trending([ 'from' => '2026-06-01', 'to' => '2026-06-07', 'limit' => 10, ]);
days remains available as a legacy v1-compatible shorthand. Do not send
from, to, and days together.
Configuration
$client = new AdanosClient( apiKey: 'sk_live_...', baseUrl: 'https://api.adanos.com', timeout: 60.0, );
The default API host is https://api.adanos.com. Explicit custom URLs and the
fully supported legacy host https://api.adanos.org remain available through
baseUrl.
Errors
Non-2xx responses throw Adanos\Exception\ApiException.
use Adanos\Exception\ApiException; try { $client->sentiment->analyze('TSLA'); } catch (ApiException $exception) { echo $exception->getStatusCode(); echo $exception->getDetail(); $payload = $exception->getPayload(); $headers = $exception->getHeaders(); }
Compatibility Alias
StockSentimentClient extends AdanosClient for compatibility with older SDK
naming.
use Adanos\StockSentimentClient; $client = new StockSentimentClient(apiKey: 'sk_live_...');
Development
composer install composer check
Live smoke tests are skipped unless ADANOS_API_KEY is present:
ADANOS_API_KEY=sk_live_... vendor/bin/phpunit --filter LiveSmokeTest
The Professional-only direct sentiment smoke test also requires:
ADANOS_API_KEY=sk_live_... ADANOS_LIVE_SENTIMENT=1 vendor/bin/phpunit --filter LiveSmokeTest
Release
Publish source from adanos-software/adanos-php and connect the repository to
Packagist as adanos/adanos-php.
License
MIT