PHP code example of ncod3v / ai-sdk

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

    

ncod3v / ai-sdk example snippets


use Ncod3v\AI\Client;

$ai = new Client('ncod3v_ihr_api_key');

// Code analysieren
$result = $ai->analyzeCode(' echo $_GET["id"]; 

$content = $ai->generateSocialContent(
    topic:     'Launch unserer neuen App',
    platforms: ['instagram', 'linkedin', 'twitter', 'tiktok'],
    tone:      'viral',  // professional|casual|viral|educational|motivational
    industry:  'Tech',
    keywords:  ['KI', 'App', 'Launch'],
    cta:       'Jetzt kostenlos testen',
    language:  'Deutsch'
);

// Jede Plattform bekommt spezifischen Content:
echo $content['instagram']['post'];
echo $content['linkedin']['post'];
echo $content['twitter']['tweet'];
echo $content['tiktok']['script'];
echo $content['tiktok']['hook'];

$analysis = $ai->analyzeStartup(
    idea:          'Automatisierte Social-Media-Planung für KMU',
    industry:      'SaaS',
    targetGroup:   'KMU',
    location:      'Deutschland',
    capital:       50000,
    founders:      2,
    experience:    'hoch',  // gering|mittel|hoch|experte
    businessModel: 'saas'
);

echo $analysis['success_probability']['overall'] . '%';
echo $analysis['financial_projection']['startup_costs']['einmalig'];
echo $analysis['financial_projection']['break_even_months'];
echo $analysis['verdict'];  // EMPFOHLEN|BEDINGT_EMPFOHLEN|NICHT_EMPFOHLEN

foreach ($analysis['risks'] as $risk) {
    echo "{$risk['risk']} → {$risk['mitigation']}\n";
}

use Ncod3v\AI\Exception\AuthException;
use Ncod3v\AI\Exception\RateLimitException;
use Ncod3v\AI\Exception\ApiException;

try {
    $result = $ai->generateSocialContent('Mein Thema', ['instagram']);
} catch (AuthException $e)    { /* Ungültiger Key */ }
  catch (RateLimitException $e) { /* Limit erreicht */ }
  catch (ApiException $e)     { /* Sonstiger Fehler */ }