PHP code example of plotdesk / plugin-sdk

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

    

plotdesk / plugin-sdk example snippets


class MyAwesomeApp extends BasicApp
{
    public function getFunctions(): array
    {
        return [[
            'name' => 'search_customers',
            'label' => 'Search Customers',
            'description' => 'Search the customer database',
            'parameters' => [
                'type' => 'object',
                'properties' => [
                    'query' => ['type' => 'string', 'description' => 'Search query'],
                ],
                'ount($results) . " customers for: {$query}";
    }
}

// Simple AI call (prompt in, text out)
$result = PluginAi::call(
    team: $this->team,
    systemPrompt: 'Classify this lead as hot, warm, or cold.',
    userPrompt: $leadDescription,
    contextType: 'plugin:my-plugin:classify',
);

// Full chat with platform access (silos, tables, apps, etc.)
$analysis = PluginChat::run(
    team: $this->team,
    groupId: $groupId,
    userMessage: 'Analyze the customer history for #123',
    contextType: 'plugin:my-plugin:analyze',
);