PHPackages                             mazin/replicate-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mazin/replicate-php

ActiveClient-library

mazin/replicate-php
===================

This is a PHP client for Replicate.

0.0.1(3y ago)414MITPHPPHP ^8.1

Since Mar 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ahmedmaazin/replicate-php)[ Packagist](https://packagist.org/packages/mazin/replicate-php)[ RSS](/packages/mazin-replicate-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Replicate PHP client
====================

[](#replicate-php-client)

This is a simple PHP client for the [Replicate](https://replicate.com/). It covers the main prediction functionalities of the [Replicate HTTP API](https://replicate.com/docs/reference/http).

Requirements
------------

[](#requirements)

- PHP 8.1

Installation
------------

[](#installation)

Install the package with composer:

```
composer require replicate/replicate-php
```

Usage
-----

[](#usage)

### Initialize the replicate client with your API token

[](#initialize-the-replicate-client-with-your-api-token)

Get your API token from your [Replicate account](https://replicate.com/account).

```
$replicate = new Replicate('token');
```

### Create a prediction

[](#create-a-prediction)

```
try {
    $prediction = $replicate->createPrediction(
        version: 'v1',
        input: ['text' => 'foo'],
    );

    echo $prediction->id; // take a look at Prediction data class for available fields
} catch (ReplicateException|ReplicateWebhookInputException|ResponseException $e) {
    echo $e->getMessage();
}
```

### Get a prediction

[](#get-a-prediction)

```
try {
    $prediction = $this->replicate->prediction(predictionId: 'prediction-id');

    echo $prediction->id;
} catch (ReplicateException|ResponseException $e) {
    // log error
}
```

### Get a list of predictions

[](#get-a-list-of-predictions)

```
try {
    $predictions = $this->replicate->predictions();

    // if you would like to paginate.
    if ($predictions->next) {

        // extract the cursor from the next url
        $nextUrl = $predictions->next;
        $query = parse_url($nextUrl, PHP_URL_QUERY);
        parse_str($query, $params);
        $cursor = $params['cursor'];

        $predictions = $this->replicate->predictions(cursor: $cursor);
        // $predictions->results;
    }

    // take a look at the Predictions data class for available fields.
} catch (ReplicateException|ResponseException $e) {
    // log error
}
```

### Cancel a prediction

[](#cancel-a-prediction)

```
try {
    $response = $this->replicate->cancelPrediction(predictionId: 'prediction-id');

    echo $response->status;
} catch (ReplicateException|ResponseException $e) {
    // log error
}
```

Development
-----------

[](#development)

### Install dependencies

[](#install-dependencies)

```
composer install
```

### Run tests

[](#run-tests)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1167d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/206b4c244af933064b5fc519adda641c299360e22386fdd430b4b8d7c3b22bf9?d=identicon)[mazin](/maintainers/mazin)

---

Top Contributors

[![ahmedmaazin](https://avatars.githubusercontent.com/u/4073159?v=4)](https://github.com/ahmedmaazin "ahmedmaazin (11 commits)")

---

Tags

machine-learningreplicateaimachine learningartificial intelligencereplicate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mazin-replicate-php/health.svg)

```
[![Health](https://phpackages.com/badges/mazin-replicate-php/health.svg)](https://phpackages.com/packages/mazin-replicate-php)
```

###  Alternatives

[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[softcreatr/php-mistral-ai-sdk

A powerful and easy-to-use PHP SDK for the Mistral AI API, allowing seamless integration of advanced AI-powered features into your PHP projects.

1517.9k](/packages/softcreatr-php-mistral-ai-sdk)[softcreatr/php-perplexity-ai-sdk

A powerful and easy-to-use PHP SDK for the pplx (Perplexity) API, allowing seamless integration of advanced AI-powered features into your PHP projects..

149.1k](/packages/softcreatr-php-perplexity-ai-sdk)[grok-php/client

Grok PHP Client is a robust and community-driven PHP client library for seamless integration with Grok AI API, offering efficient access to advanced AI and data processing capabilities.

325.9k4](/packages/grok-php-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
