Download the PHP package robertgdev/ta-lib-hybrid without Composer

On this page you can find all versions of the php package robertgdev/ta-lib-hybrid. 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 ta-lib-hybrid

TaLibHybrid

A hybrid PHP wrapper for TA-Lib that provides 161 technical analysis indicator functions with automatic pass-through to the C extension when available, and a pure-PHP fallback when it's not.

Installation

The C extension is optional but recommended for performance:

Add to php.ini:

The library works without the extension — it will automatically fall back to the pure-PHP implementation.

Requirements

Design

Goals

  1. Transparent dual-backend — When ext-ta_lib is loaded, all calls go through the C extension for maximum speed. When it's absent, the pure-PHP fallback delivers identical results.
  2. Zero-disruption migration — Procedural ta_* polyfill functions (ta_sma, ta_atr, etc.) and TA_* constants are defined only when the extension is not present, so existing code using ta_sma() works unchanged.
  3. Consistent output format — Both backends return the same array structure: null-padded aligned arrays where leading positions (the lookback period) are null and actual values start at the correct offset. Multi-output indicators use lowercase string keys.
  4. Full coverage — All 161 TA-Lib indicator functions are implemented, including imi and mom which are missing from the C extension.

Architecture

Auto-detection: TaLibHybrid checks extension_loaded('ta_lib') on first call and selects the appropriate backend. You can override this with TaLibHybrid::setBackend().

Fallback delegation: ExtensionBackend delegates mom() and mama() to FallbackBackend because the C extension does not provide ta_mom, and ta_mama returns a broken flat array instead of the expected multi-output format.

Directory structure

Usage

OOP via static facade

Procedural polyfill

Works identically to the C extension's function signatures:

These functions are only defined when ext-ta_lib is not loaded, so they never conflict with the extension.

Backend selection

Direct backend instantiation

Output format

All indicator methods return arrays aligned with the input index. Values in the lookback period are null:

Multi-output indicators return an associative array of such arrays:

Indicator categories

Category Count Examples
Overlap Studies 18 sma, ema, wma, dema, tema, bbands, kama, t3
Momentum Indicators 31 rsi, macd, stoch, adx, cci, willr, mom, imi
Pattern Recognition 61 cdldoji, cdlengulfing, cdlhammer, cdlmorningstar
Statistic Functions 9 beta, correl, stddev, linearreg, tsf
Math Operators 11 add, sub, mult, div, sum, max, min
Math Transform 15 sin, cos, sqrt, exp, ln, ceil, floor
Volatility Indicators 3 atr, natr, trange
Cycle Indicators 5 ht_dcperiod, ht_dcphase, ht_sine
Volume Indicators 3 obv, ad, adosc
Price Transform 5 avgprice, medprice, typprice, wclprice

Exceptions

Constants

When ext-ta_lib is loaded, it provides TA_MA_TYPE_SMA and similar constants. When it's not, Constants.php polyfills them all:

Each constant is guarded individually with if (!defined(...)), so they coexist correctly with the extension.

Testing

The package includes a Pest test suite with 213 tests and ~3000 assertions:

Test suites:

License

MIT


All versions of ta-lib-hybrid with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 robertgdev/ta-lib-hybrid contains the following files

Loading the files please wait ...