Download the PHP package finlight/client without Composer
On this page you can find all versions of the php package finlight/client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download finlight/client
More information about finlight/client
Files in finlight/client
Package client
Short Description PHP client for the finlight.me financial news API - search sentiment-scored, entity-tagged market news and verify finlight webhooks.
License MIT
Homepage https://finlight.me
Informations about the package client
finlight PHP Client
English | 한국어
PHP client for the finlight.me financial news API. Search market news enriched with sentiment scores and entity tags (tickers, ISIN, OpenFIGI), and verify inbound finlight webhooks.
Full API reference: docs.finlight.me · Get an API key: app.finlight.me
Requirements
- PHP 8.1 or newer
- Any PSR-18 HTTP client (Guzzle is used automatically when installed)
Installation
If your project has no PSR-18 client yet, add one:
Quick start
Searching articles
Every filter is optional — pass only what you need, as named arguments.
| Parameter | Type | Notes |
|---|---|---|
query |
string |
Boolean operators, field filters (ticker:, source:, isin:) and quoted phrases |
tickers |
string[] |
e.g. ['AAPL', 'NVDA'] |
sources |
string[] |
Replaces the default source set |
optInSources |
string[] |
Added on top of the default set |
excludeSources |
string[] |
Removed from results |
countries |
string[] |
ISO 3166-1 alpha-2 |
categories |
ArticleCategory[] |
Topic filter |
from / to |
string |
YYYY-MM-DD or ISO 8601 |
language |
string |
ISO 639-1, defaults to en server-side |
includeContent |
bool |
Full article body |
includeEntities |
bool |
Tagged company data |
excludeEmptyContent |
bool |
Skip articles without content |
orderBy / order |
OrderBy / SortOrder |
Sorting |
page / pageSize |
int |
pageSize accepts 1–100 |
ArticleResponse is Countable and IteratorAggregate, so count($response) and foreach ($response as $article) both work. The raw list stays available as $response->articles.
A single article by URL
Sources
Webhooks
finlight signs every delivery with HMAC-SHA256. WebhookService verifies the signature, enforces a five-minute replay window when a timestamp header is present, and hands back a parsed Article.
It is static — no client instance and no API key required.
The body must be the raw, unparsed request bytes. Any middleware that decodes and re-encodes JSON before you read it will invalidate the signature.
Plain PHP
Laravel
Symfony
Configuration
| Option | Default | Meaning |
|---|---|---|
apiKey |
— | Required. Sent as the X-API-KEY header |
baseUrl |
https://api.finlight.me |
API base URL |
timeoutMs |
5000 |
Applies to the HTTP client this library creates for you |
retryCount |
3 |
Total attempts, so the default is one call plus two retries |
Bringing your own HTTP client
Any PSR-18 client works. Inject it to control timeouts, proxies, middleware or logging:
When you inject a client, timeoutMs no longer applies — PSR-18 has no portable timeout setting, so configure it on your own client.
Errors
Everything this library throws implements Finlight\Exception\FinlightException, so one catch block covers the lot.
| Exception | When |
|---|---|
AuthenticationException |
HTTP 401 / 403 — key invalid or plan lacks access |
NotFoundException |
HTTP 404 |
RateLimitException |
HTTP 429 after retries; carries retryAfterSeconds |
ApiException |
Any other non-2xx; carries statusCode and responseBody |
TransportException |
No response at all — DNS, connection, TLS, timeout |
MalformedResponseException |
A 2xx body missing a required field |
WebhookVerificationException |
Signature, timestamp or payload rejected |
ConfigurationException |
No PSR-18 client or PSR-17 factory available at construction |
Retries
HTTP 429, 500, 502, 503 and 504 are retried automatically with exponential backoff (500 ms, 1 s, 2 s, …, capped at 30 s per pause), matching the official TypeScript client. Transport failures are not retried — they surface immediately as a TransportException.
Scope
This client covers the REST API and webhook verification.
WebSocket streaming is intentionally not included. PHP's request-response model is a poor fit for a long-lived stream, and doing it properly would require ReactPHP or Ratchet plus a supervised worker process. If you need the live stream, use the TypeScript, Go, Python or .NET clients — see docs.finlight.me. For push delivery into a PHP application, webhooks are the supported path.
Development
CI runs the suite against PHP 8.1 through 8.4.
Releasing
The package is distributed through Packagist, which reads this repository directly — there is no upload step.
- Bump
FinlightClient::VERSIONand updateCHANGELOG.md. - Tag the release:
git tag v1.0.1 && git push --tags. - Packagist picks up the tag automatically once the GitHub integration is enabled (Packagist → your profile → Settings → GitHub integration, or the package's Update button for a manual sync).
License
MIT — see LICENSE.
All versions of client with dependencies
ext-json Version *
php-http/discovery Version ^1.19
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0