1. Go to this page and download the library: Download purple-php/sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
purple-php / sdk example snippets
use Purple\Sdk;
use Purple\Testing\FakeProvider;
$sdk = new Sdk(
provider: FakeProvider::replying('{"summary":"Ready for catalog review."}'),
providerName: 'fake',
model: 'fake-model',
);
$summary = $sdk->smartFunction(
name: 'catalog.summary',
prompt: 'Summarize {{ title }} as JSON.',
outputSchema: '{"type":"object","
use Purple\ProviderProfile;
use Purple\Sdk;
$sdk = Sdk::openAI(
profile: ProviderProfile::openAI(
model: 'gpt-4.1-mini',
secretName: 'OPENAI_API_KEY',
),
);
use Purple\Provider\Bedrock\BedrockSdk;
use Purple\ProviderProfile;
$sdk = BedrockSdk::create(
profile: ProviderProfile::bedrock(model: 'anthropic.model'),
region: 'us-east-1',
);