Skip to content

Releases: marceloeatworld/replicate-php

v1.1.0

29 Mar 22:02

Choose a tag to compare

No code changes. Version bump to trigger Packagist update for clients using ^1.0.

Clients on "marceloeatworld/replicate-php": "^1.0" will receive this version automatically via composer update.

v1.0.0 - Full Replicate API coverage with Saloon v4

29 Mar 22:01

Choose a tag to compare

What's new

Complete rewrite of the Replicate PHP client. This package is a fork of benbjurstrom/replicate-php which only supported predictions. This version covers the entire Replicate HTTP API with 36 endpoints across 9 resources.

Highlights

  • Saloon v4 with security patches (CVE-2026-33942, CVE-2026-33182, CVE-2026-33183)
  • PHP 8.2+ required
  • Bearer authentication (was Token prefix)
  • 17 typed DTOs with readonly properties
  • Compatible with Laravel 11, 12, 13

Full API coverage

Resource Methods
Predictions list, get, create, cancel
Models list, get, create, update, delete, createPrediction
Model Versions getVersion, listVersions, deleteVersion
Deployments list, get, create, update, delete, createPrediction
Trainings list, get, create, cancel
Files list, get, upload, delete
Collections list, get
Hardware list
Webhooks getSecret
Account get

New features

  • Synchronous predictions with wait parameter (Prefer: wait=N header)
  • Streaming support via stream parameter
  • Webhook parameters directly on create methods
  • File uploads with multipart support
  • Cursor-based pagination on all list endpoints

Bug fixes

  • Fixed trailing newline in cancel endpoint URL (broke every cancel request)
  • Fixed PredictionsData reading model from wrong JSON level
  • Fixed missing null-coalescing on nullable fields in list responses

Breaking changes from the original package

  • Namespace: BenBjurstrom\ReplicateMarceloEatWorld\Replicate
  • Webhook: ->withWebhook()->create() chain removed, pass webhook param directly to create()
  • Deployment predictions moved from predictions()->createForDeployment() to deployments()->createPrediction()
  • Requires PHP 8.2+ (was 8.1)
  • Requires Saloon v4 (was v3)

Installation

composer require marceloeatworld/replicate-php
use MarceloEatWorld\Replicate\Replicate;

$replicate = new Replicate(apiToken: $_ENV['REPLICATE_API_TOKEN']);

$prediction = $replicate->predictions()->create(
    version: 'stability-ai/sdxl:c221b2b8...',
    input: ['prompt' => 'a photo of an astronaut riding a horse on mars'],
);