PHP code example of dikki / claude-sdk

1. Go to this page and download the library: Download dikki/claude-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/ */

    

dikki / claude-sdk example snippets


$claude = new \Dikki\Claude\Claude($apiKey, 'claude-2.1');

$response = $claude->getResponse("Write an essay on AI.");

$response = $claude->getTextResponse("Write an essay on AI.");

// Create an instance of Claude
$claude = new \Dikki\Claude\Claude($apiKey, 'claude-2.1');

// Get full response
$response = $claude->getResponse("Write an essay on AI.");

// Get only text response
$textResponse = $claude->getTextResponse("Write an essay on AI.");