OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

TransformersPHP

TransformersPHP is an open-source PHP library that provides a Transformers-style pipeline API for running pretrained ONNX machine-learning models in PHP applications. It uses ONNX Runtime and supports tasks including text generation, summarization and translation.

Independent OpenViST project profile, based on linked sources.

TransformersPHP — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when a PHP application needs a Transformers-like interface to pretrained ONNX models and its runtime environment can meet the platform-specific ONNX and PHP FFI requirements.

Who it is for

  • PHP developers adding pretrained model tasks to an existing application.
  • Teams using Hugging Face-hosted ONNX models from PHP.

Documented uses

  • Add text generation, summarization or translation to a PHP project.
  • Use a pipeline that groups a model with its task-specific preprocessing and postprocessing.
  • Configure model downloads, caching, authentication or logging for an application.
Before you choose

Requirements & limits

  • TransformersPHP uses ONNX Runtime and only works with ONNX models; PyTorch, TensorFlow or JAX models must be converted first.
  • The ONNX dependency is platform-specific, so install the package in the target runtime environment.
  • PHP FFI must be enabled for the library to interact with ONNX Runtime.
  • Model weights are fetched on first use by default, which can delay the first pipeline run; pre-downloading intended models is recommended.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install TransformersPHP in the target PHP environment

Add the library through Composer and check the documented FFI requirement before using models.

Before you start

  • A PHP environment; the README notes FFI is included in PHP 7.4 and later but may not be enabled.
  • Access to Composer and the target execution environment.

Steps

  1. Run composer require codewithkyrian/transformers on the environment where the code will run.

  2. If FFI is not enabled, enable extension = ffi and set ffi.enable = true in php.ini.

  3. Restart the web server or PHP-FPM service after changing php.ini.

Expected outcome

The package is installed in the target environment with the documented FFI settings available for ONNX Runtime access.

Guide limitations

  • The ONNX library is platform-specific, so installation should take place on the target platform, including inside the relevant Docker container.
  • These steps cover installation and FFI configuration, not running a model.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
15 October 2026
Original website title
CodeWithKyrian/transformers-php · Official homepage title · retained in its source language