PHP code example of tuzlu07x / social-media-ai-agent

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

    

tuzlu07x / social-media-ai-agent example snippets



use Dotenv\Dotenv;

$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();



use Tuzlu07x\SocialMediaAIAgent\Agent;
use Tuzlu07x\SocialMediaAIAgent\AI\OpenAIAdapter;
use Tuzlu07x\SocialMediaAIAgent\SocialMedia\TwitterAdapter;

$agent = new Agent(new OpenAIAdapter(getenv('OPENAI_API_KEY')));
$agent->addSocialMediaAdapter('twitter', new TwitterAdapter(
    getenv('TWITTER_API_KEY'),
    getenv('TWITTER_API_SECRET'),
    getenv('TWITTER_ACCESS_TOKEN'),
    getenv('TWITTER_ACCESS_TOKEN_SECRET')
));

$result = $agent->processInput("Tweet at 8 PM: Hello Twitter");
echo $result; // "scheduled time: postText at 8 PM"
bash
php bin/agent agent:run "<input>" --ai=<ai_model> --platform=<platform>
bash
php bin/agent agent:run "Hello" --ai=unknown --platform=twitter