PHPackages                             tuzlu07x/social-media-ai-agent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tuzlu07x/social-media-ai-agent

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tuzlu07x/social-media-ai-agent
==============================

A PHP-based open-source social media AI agent for automating actions

v1.0.0(1y ago)24MITPHPPHP ^8.0

Since Feb 27Pushed 1y ago2 watchersCompare

[ Source](https://github.com/tuzlu07x/social-media-ai-agent)[ Packagist](https://packagist.org/packages/tuzlu07x/social-media-ai-agent)[ RSS](/packages/tuzlu07x-social-media-ai-agent/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Social Media AI Agent
=====================

[](#social-media-ai-agent)

**Social Media AI Agent** is an open-source PHP library that empowers developers to automate social media interactions using artificial intelligence. This package integrates with popular platforms like Twitter, Instagram, TikTok, and LinkedIn, and supports multiple AI models such as OpenAI, DeepSeek, HuggingFace, Gemini, and Grok. Whether you want to schedule posts, reply to messages, analyze trends, or process custom inputs, this agent provides a flexible and extensible framework to streamline your social media workflows.

Features
--------

[](#features)

- **Multi-Platform Support**: Connect to Twitter and Instagram.
- **AI Integration**: Leverage OpenAI, DeepSeek, HuggingFace, Grok, or add your custom AI models.
- **Dynamic Actions**: Post text, share images, reply to messages, fetch trending topics, and more.
- **Scheduling**: Schedule posts for future execution (real scheduler implementation pending).
- **Modular Design**: Built with interfaces for easy extension and maintenance.
- **Open Source**: Released under the MIT License, free to use and contribute.

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Composer
- API keys for social media platforms and AI services you plan to use

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require tuzlu07x/social-media-ai-agent
```

Alternatively, clone the repository and install dependencies manually:

```
git clone https://github.com/tuzlu07x/social-media-ai-agent.git
cd social-media-ai-agent
composer install
```

Configuration
-------------

[](#configuration)

To use the agent, you need to configure API keys for the social media platforms and AI models. It’s recommended to store these in a .env file and load them using a library like vlucas/phpdotenv.

### Example .env File

[](#example-env-file)

```
OPENAI_API_KEY=your_openai_key
DEEPSEEK_API_KEY=your_deepseek_key
HF_API_KEY=your_huggingface_key
GEMINI_API_KEY=your_gemini_key
GROK_API_KEY=your_grok_key
TWITTER_API_KEY=your_twitter_api_key
TWITTER_API_SECRET=your_twitter_api_secret
TWITTER_ACCESS_TOKEN=your_twitter_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_twitter_access_token_secret
INSTAGRAM_ACCESS_TOKEN=your_instagram_access_token
```

### Loading Environment Variables

[](#loading-environment-variables)

If you’re using `phpdotenv`, add this to your script:

```
composer require vlucas/phpdotenv
```

Then load the `.env` file:

```
require __DIR__ . '/vendor/autoload.php';
use Dotenv\Dotenv;

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

Usage
-----

[](#usage)

Command Line Interface (CLI) The package provides a CLI tool (`bin/agent`) to interact with the agent.

### Basic Syntax

[](#basic-syntax)

```
php bin/agent agent:run "" --ai= --platform=
```

``: The input string to process (e.g., "Tweet at 8 PM: Hello World"). `--ai`: The AI model to use (e.g., `openai`, `deepseek`, `huggingface`, `gemini`, `grok`). Default: openai. `--platform`: The social media platform (e.g., twitter, instagram). Default: twitter.

1. Schedule a Tweet with OpenAI

```
php bin/agent agent:run "Tweet at 8 PM: Hello Twitter" --ai=openai --platform=twitter
```

Output: Scheduled action: postText at 8 PM 2. Post an Image to Instagram with DeepSeek

2. Post an Image to Instagram with DeepSeek

```
php bin/agent agent:run "Instagram post: /path/to/image.jpg" --ai=deepseek --platform=instagram
```

Output: Image shared to Instagram:

3. Invalid Input

```
php bin/agent agent:run "Hello" --ai=unknown --platform=twitter
```

Output: Error: AI model: unknown

Programmatic Usage
------------------

[](#programmatic-usage)

You can also use the agent directly in your PHP code:

```
require 'vendor/autoload.php';

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"
```

### Supported Platforms

[](#supported-platforms)

`Twitter`: Post tweets, reply to messages (more features in progress). `Instagram`: Share images (text posts and replies in progress). `TikTok`: Skeleton implemented, full support coming soon. `LinkedIn`: Skeleton implemented, full support coming soon.

### Supported AI Models

[](#supported-ai-models)

`OpenAI`: Fully supported with the GPT-3.5-turbo model. `DeepSeek`: Experimental support (API endpoint assumed). `HuggingFace`: Supports inference API with customizable models. `Grok`: Experimental support (xAI API assumed).

### Extending the Agent

[](#extending-the-agent)

1. Adding a New Social Media Platform
2. Create a new adapter in `src/SocialMedia/` implementing SocialMediaAdapterInterface.
3. Update `ServerCommand::addSocialMediaAdapter` to include your platform.
4. Adding a New AI Model
5. Create a new adapter in `src/AI/` implementing `AIAdapterInterface`.
6. Update `ServerCommand::createAIAdapter` to include your model.

Contributing
------------

[](#contributing)

Contributions are welcome! Please follow these steps:

1. Fork the repository.
2. Create a new branch (git checkout -b feature/your-feature).
3. Commit your changes (git commit -m "Add your feature").
4. Push to your branch (git push origin feature/your-feature).
5. Open a Pull Request.

Roadmap
-------

[](#roadmap)

- Real scheduler for timed actions (e.g., using cron or a queue system).
- Full implementations for TikTok and LinkedIn adapters.
- Message retrieval and trending topic analysis.
- Improved error handling and logging.

License
=======

[](#license)

This project is licensed under the MIT License

Credits
=======

[](#credits)

Developed by Fatih Tuzlu (tuzlu07x). Special thanks to the open-source community!

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

439d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c883222589152dfc614d8ddcb1a872208be25fd07246d2b9f2b2d3741ebf9876?d=identicon)[tuzlu07x](/maintainers/tuzlu07x)

---

Top Contributors

[![tuzlu07x](https://avatars.githubusercontent.com/u/86893131?v=4)](https://github.com/tuzlu07x "tuzlu07x (10 commits)")

---

Tags

phpautomationinstagramaitwittersocial media

### Embed Badge

![Health badge](/badges/tuzlu07x-social-media-ai-agent/health.svg)

```
[![Health](https://phpackages.com/badges/tuzlu07x-social-media-ai-agent/health.svg)](https://phpackages.com/packages/tuzlu07x-social-media-ai-agent)
```

###  Alternatives

[codewithkyrian/transformers

State-of-the-art Machine Learning for PHP. Run Transformers in PHP

749231.8k5](/packages/codewithkyrian-transformers)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[swoole/phpy

Connecting the Python and PHP ecosystems together

6376.4k1](/packages/swoole-phpy)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[pdir/social-feed-bundle

Social feed extension for Contao CMS

1414.8k](/packages/pdir-social-feed-bundle)[rumenx/php-seo

AI-powered, framework-agnostic PHP package for automated SEO optimization. Intelligently generates meta tags, titles, descriptions, and alt texts using configurable AI providers or manual patterns.

102.0k](/packages/rumenx-php-seo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
