Official PHP client for the Indices-API.

Maintainers

Package info

github.com/Zyla-Labs/indices-php-sdk

pkg:composer/indices-api/sdk

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2026-02-12 14:22 UTC

This package is not auto-updated.

Last update: 2026-03-27 13:06:09 UTC


README

Official PHP SDK for Indices-API – the ultimate API for accessing comprehensive and accurate real-time and historical rates on a wide range of financial indices.

Indices-API supports many index symbols with frequent updates (depending on your plan). Start a 7‑day free trial and cancel anytime.

Key Features

  • Built for PHP developers: Simple, object-oriented API designed for modern PHP (>= 8.0).
  • Robust JSON API: Thin, predictable wrapper over the Indices-API JSON endpoints.
  • Top-tier security: Your API key is sent over HTTPS to trusted, enterprise-grade infrastructure.
  • Reliable data sources: Data aggregated from reputable financial and market data providers.
  • Flexible integration: Works in any PHP app or framework (Laravel, Symfony, Slim, etc.).
  • Historical data access: Query historical and time-series data for deeper analysis.
  • Exceptional accuracy: Real-time and historical index data with high precision.
  • User-friendly documentation: See the full API docs at https://indices-api.com/documentation.
  • Specialized support: Dedicated support team to help with integration and use-cases.

Supported Indices

Indices-API covers a wide range of instruments, including (examples):

  • Equity indices: S&P 500, Nasdaq 100, Dow Jones, FTSE 100, and more.
  • Regional indices: European, Asian, and emerging market indices.
  • Sector indices: Technology, financials, energy, and other sector-based benchmarks.

You can find the full, always up-to-date list of supported symbols in the Supported Indices section of the official documentation.

Installation

Install the SDK via Composer:

composer require indices-api/sdk

Getting Started

First, sign up at https://indices-api.com to get your API key and some free credits.

Basic Usage

<?php

require 'vendor/autoload.php';

use IndicesApi\IndicesClient;

$client = new IndicesClient('REPLACE-WITH-YOUR-ACCESS-KEY');

$latest = $client->getLatest([
    'base'    => 'USD',
    'symbols' => '000001,IXIC,GSPC,EGX-30',
]);

print_r($latest);

Example Response

Example response for a successful latest request (shape may vary depending on plan and endpoint):

{
  "data": {
    "success": true,
    "timestamp": 1715796300,
    "date": "2024-05-15",
    "base": "USD",
    "rates": {
      "000001": 3025.15,
      "IXIC": 18450.33,
      "GSPC": 5231.57,
      "EGX-30": 27500.42,
      "USD": 1
    },
    "unit": {
      "000001": "index points",
      "IXIC": "index points",
      "GSPC": "index points",
      "EGX-30": "index points"
    }
  }
}

The exact structure of the data object depends on the endpoint and your plan. Refer to the official documentation for the complete schema.

Available Methods

All methods live on the IndicesApi\IndicesClient class.

getLatest(array $params = []): array

Fetches the most recent rates for the requested symbols.

$latest = $client->getLatest([
    'base'    => 'USD',
    'symbols' => '000001,IXIC,GSPC,EGX-30',
]);

getHistorical(string $date, array $params = []): array

Get historical rates for a given date (YYYY-MM-DD).

$historical = $client->getHistorical('2024-05-15', [
    'base'    => 'USD',
    'symbols' => '000001,IXIC,GSPC,EGX-30',
]);

getTimeSeries(array $params): array

Retrieve time-series data between two dates.

$timeseries = $client->getTimeSeries([
    'start_date' => '2024-05-01',
    'end_date'   => '2024-05-15',
    'base'       => 'USD',
    'symbols'    => '000001,IXIC,GSPC,EGX-30',
]);

getFluctuation(array $params): array

Get day-to-day or period fluctuation data.

$fluctuation = $client->getFluctuation([
    'start_date' => '2024-05-01',
    'end_date'   => '2024-05-15',
    'base'       => 'USD',
    'symbols'    => '000001,IXIC,GSPC,EGX-30',
]);

convert(array $params): array

Convert an amount between two symbols.

$conversion = $client->convert([
    'from'   => 'GSPC',
    'to'     => 'IXIC',
    'amount' => 100,
]);

getSymbols(): array

List available symbols and their metadata (depends on plan).

$symbols = $client->getSymbols();

Note: The Seasonality endpoint is not yet available in this PHP SDK.

Error Handling

All requests may throw an IndicesApi\IndicesApiException when:

  • The API returns an error payload, or
  • The network fails, or
  • The response is not valid JSON.
<?php

require 'vendor/autoload.php';

use IndicesApi\IndicesClient;
use IndicesApi\IndicesApiException;

$client = new IndicesClient('REPLACE-WITH-YOUR-ACCESS-KEY');

try {
    $latest = $client->getLatest([
        'base'    => 'USD',
        'symbols' => '000001,IXIC,GSPC,EGX-30',
    ]);

    print_r($latest);
} catch (IndicesApiException $e) {
    echo 'Status code: ' . ($e->getStatusCode() ?? 'n/a') . PHP_EOL;
    echo 'Error code: ' . ($e->getErrorCode() ?? 'n/a') . PHP_EOL;
    echo 'Message: ' . $e->getMessage() . PHP_EOL;
}

Documentation & Support

  • API documentation: https://indices-api.com/documentation
  • Website: https://indices-api.com

If you have questions or need help with integration, please reach out through the official support channels listed in the Indices-API dashboard.