Download the PHP package coinpaprika/dexpaprika-sdk without Composer

On this page you can find all versions of the php package coinpaprika/dexpaprika-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dexpaprika-sdk

DexPaprika PHP SDK

A PHP SDK for interacting with the DexPaprika API, providing access to cryptocurrency DEX data, token information, liquidity pools, and market statistics.

The DEX pools endpoint is gone (v1.6.0)

DexPaprika removed GET /networks/{network}/dexes/{dex}/pools. It returns 410 Gone. DexesApi::getDexPools() now calls /networks/{network}/pools/search with a dex_name filter. The method name and its arguments are unchanged: the DEX id you pass is sent as dex_name. Despite that parameter's name it matches the DEX id from GET /networks/{network}/dexes (the dex_id field), case-insensitively. Passing that response's dex_name field instead, a human display name such as Uniswap V3, returns HTTP 200 with an empty result set rather than an error, so always pass the id.

The response is the cursor-paginated search shape, so rows live under results and the 24h volume field is volume_usd_24h. There is no bare volume_usd and no page_info.

Tokens inside a search row carry id, chain and has_image only. Call $client->tokens->getTokenDetails($chain, $id) if you need names or symbols.

Breaking changes in v1.3.0

IMPORTANT: The global /pools endpoint has been deprecated in DexPaprika API v1.3.0. All pool operations now require a network parameter.

Migration Required

See the CHANGELOG for complete details.

Unified search endpoints (v1.2.0)

getNetworkPools(), filterPools(), getTopTokens() and filterTokens() now call the unified pools/search and tokens/search endpoints (the previous list/filter/top endpoints return 410 Gone). The public method signatures are unchanged: legacy sort values (for example volume_usd, fdv) and legacy filter parameter names (for example volume24hMin) are mapped to the canonical search names automatically.

These endpoints are cursor-paginated, so the response shape is:

The page option is still accepted for backward compatibility but is ignored.

Features

Requirements

Installation

Install via Composer:

Basic Usage

Using an API key (optional)

The SDK works without a key. No signup, no card. Everything below is optional.

One exception: paging search results past the first page needs a key. pools/search, tokens/search and the methods backed by them (getNetworkPools(), getDexPools(), getTokenPools(), filterPools(), filterTokens(), getTopTokens()) serve the first page keyless, limit and all. Asking for a second page (passing cursor) without a key gets a 403 from the API. Any key, a free one included, pages without limit. Register at https://console.dexpaprika.com.

A free key raises the monthly credit allowance. It does not raise the per-minute request limit, which is the same on both free tiers. Current figures are on the rate limits page.

setApiKey() beats the environment variable, and no key at all keeps the previous keyless behaviour unchanged.

The key is sent as the entire Authorization value, with nothing in front of it. You never write the header yourself, so this only matters when debugging what went out.

Dev and Pro customers also set the base URL, because the host does not change on its own. Free keys are served from the default host and sending one to the Pro host returns 403, so the switch has to be deliberate:

A malformed key on api-pro.dexpaprika.com never reaches the API at all. It gets a 403 straight from the edge in front of it, an HTML page, not the API's usual JSON error. The SDK turns that into a ClientException whose message says the key was refused before it reached the API: check that the whole key was pasted into the Authorization header with nothing in front of it, and that it is a key from https://console.dexpaprika.com. A 403 with a JSON body, such as the keyless-paging error above, is unaffected and keeps its own message.

One gotcha worth knowing. On the data endpoints a key the API cannot read is ignored rather than rejected: the call returns 200 with real data and you are quietly served as an anonymous caller. To confirm a key is landing, call /usage and check the plan field; keyless means the key never arrived.

Advanced Configuration

Caching Responses

The SDK provides built-in caching for API responses:

Automatic Retry

The SDK automatically retries failed requests with exponential backoff:

Only certain types of failures will be retried:

A 429 waits for what the API actually asked for, not just the fixed schedule above. The API sends the wait as a Retry-After header on a keyed request, or a retry_after field in the JSON body on a keyless one (which carries no header at all). The SDK checks the header first, then the body, and if the server's figure is longer than the next scheduled delay, the server's figure is used instead, clamped to 60 seconds. An HTTP-date form of the header is not parsed; that case, like a response with neither field, uses the schedule above.

Sleeping between retries goes through a function you can replace:

Tests use this to exercise retry behavior, including a 60 second wait, without a 60 second test. Leave it unset and the SDK sleeps for real.

API Components

This SDK provides the following API modules:

Networks

Statistics

DEXes

Pools

OHLCV start and end take a relative offset from now (-24h, -7d, -90m) as well as ISO dates and Unix timestamps. How far back you can go and how fine the candles can be depends on your plan: without a key, the last 24 hours at 1h and longer; a free key opens 7 days at 10m and longer; Dev 30 days at every interval; Pro unlimited. A request outside your plan throws a ClientException carrying the API's message. Full table: OHLCV limits by plan.

Transaction from and to, and createdAfter and createdBefore on filterPools and filterTokens, take the same relative offsets, as well as Unix seconds, RFC 3339 and YYYY-MM-DD. Transactions go back 7 days at most.

Tokens

Token OHLCV

Candles for a token, priced in USD: a volume-weighted price built across every pool the token trades in on the network, with volume summed the same way. Same record shape as pool OHLCV, and no inversed option, because a USD price has no pair side to flip.

This endpoint needs a Dev, Pro or Enterprise plan and must be called against api-pro.dexpaprika.com with the API key set as the whole Authorization value:

A keyless or free-key call gets 403, and getTokenOHLCV() throws a ClientException carrying the API's message. See Get OHLCV data for a token and current plan details on the pricing page.

Technical indicators

getPoolIndicator() and getTokenIndicator() compute rsi, ema, macd, bbands or vwap over a pool's or token's OHLCV candles. Only the parameters the chosen indicator uses should be set: period for rsi, ema, bbands and vwap; fast_period, slow_period and signal_period for macd; std_dev for bbands. Sending a parameter that belongs to a different indicator is refused by the API with a 400.

Pool indicators work on every plan, with the same interval and history limits as pool OHLCV above, so this RSI call works without a key:

Token indicators need a Dev, Pro or Enterprise key and must be called against api-pro.dexpaprika.com, the same host as getTokenOHLCV():

A keyless or free-key call to getTokenIndicator() gets 403, and the thrown ClientException carries the API's message; getErrorData()['required_tier'] names the plan that lifts the limit. See Get a technical indicator for a pool, Get a technical indicator for a token, the technical indicators tutorial, current rate limits on the rate limits page, plan pricing on the pricing page, and get a free key at console.dexpaprika.com.

Pool Filtering

Price change windows

pools/search sorts and filters on five price-change windows: 48h, 24h, 6h, 1h and 5m. Pass the window as sortBy, or bound it with the matching min/max option. Bounds are percentages, and a max is normally negative because that is how you ask for a drop.

Tighten either bound and the result set can legitimately come back empty, because a screen for a sharp hourly drop on a well funded pool matches nothing on a calm day. An empty results[] there is an answer, not a failure.

The 24h window is the only one of the five that also works on tokens. getTopTokens() sorts by price_change_percentage_24h, and filterTokens() takes the matching bounds:

The 48h, 6h, 1h and 5m windows exist on pools only. tokens/search returns 400 when you sort by one of them, silently ignores their filter bounds, and token rows carry no short-window price-change field at all.

Top Tokens & Token Filtering

Batch Token Prices

Search

Response Formats

By default, the SDK returns responses as PHP arrays. You can change this to objects:

Exception Handling

The SDK throws different types of exceptions:

Examples

See the examples directory for more comprehensive usage examples:

Testing

Run tests with PHPUnit:

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page or submit a pull request.

Versioning

This project adheres to Semantic Versioning. For the list of available versions, see the tags on this repository.

Support

For support, please open an issue on the GitHub repository or contact the DexPaprika team.

Resources


All versions of dexpaprika-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
guzzlehttp/guzzle Version ^8.0
psr/log Version ^1.1 || ^2.0 || ^3.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package coinpaprika/dexpaprika-sdk contains the following files

Loading the files please wait ...