Download the PHP package benbjurstrom/replicate-php without Composer
On this page you can find all versions of the php package benbjurstrom/replicate-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benbjurstrom/replicate-php
More information about benbjurstrom/replicate-php
Files in benbjurstrom/replicate-php
Package replicate-php
Short Description A PHP client for the Replicate API
License MIT
Informations about the package replicate-php
Replicate PHP client
This is a framework-agnostic PHP client for Replicate.com built on the amazing Saloon v3 🤠 library. Use it to easily interact with machine learning models such as Stable Diffusion right from your PHP application.
Table of contents
🚀 Quick start
Install with composer.
Create a new api instance.
Then use it to invoke your model (or in replicate terms "create a prediction").
Note that the input parameters will vary depending on what version (model) you're using. In this example version db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf is a Stable Diffusion 2.1 model optimized for speed.
Using with Laravel
Begin by adding your credentials to your services config file.
Bind the Replicate
class in a service provider.
`
And use anywhere in your application.
Test your integration using Saloon's amazing response recording.
Response Data
All responses are returned as data objects. Detailed information can be found by inspecting the following class properties:
Webhooks
Replicate allows you to configure a webhook to be called when your prediction is complete. To do so chain withWebhook($url)
onto your api instance before calling the create
method. For example:
Available Prediction Methods
get()
Use to get details about an existing prediction. If the prediction has completed the results will be under the output property.
list()
Use to get a cursor paginated list of predictions. Returns an PredictionsData object.
create()
Use to create a new prediction (invoke a model). Returns an PredictionData object.
Credits
- Ben Bjurstrom
- All Contributors
License
The MIT License (MIT). Please see License File for more information.