Streamline Your Social Statuses, Effortlessly!
Built with the tools and technologies:
I. Overview II. Features III. Project Structure IV. Usage V. Getting Started VI. Docker VII. Changelog VIII. License
v-chatgpt-social-status-feeds is a modular PHP application for managing, scheduling, and distributing social media status updates. It features user authentication, account management, status scheduling, and real-time RSS feeds, all with a focus on security and extensibility. Scheduled posts are recorded in a compact status_jobs table and processed by purpose-built cron targets. Built for social media managers and developers, it streamlines multi-account status posting and automation.
All PHP source files live inside the root directory. The code uses a lightweight MVC approach with controllers, models, and views organized under root/app. Bootstrapping is handled by Composer's vendor/autoload.php and root/config.php. For an easy local setup, the repository includes a docker folder containing a Dockerfile and docker-compose.yml that provision Apache and MariaDB.
Version 3.0.0 introduces improvements such as dedicated classes for all database operations, a more intuitive user interface, and enhanced user settings for prompt customization. The API schema is now more structured, and the platform is more robust and user-friendly.
- CSRF Protection: All forms include CSRF tokens to prevent cross-site request forgery attacks.
- Input Validation: User inputs are validated and sanitized to prevent SQL injection and XSS attacks.
- Session Management: Secure session handling to prevent session fixation and hijacking.
- Cookie Security: Session cookies are configured via
session_set_cookie_params()withhttponly,secure, andSameSite=Laxflags for better protection. - IP Blacklisting: Monitors and blacklists suspicious IP addresses to prevent brute-force attacks.
- Safe Media Storage: Generates images using sanitized filesystem paths while preserving original account identifiers for database access.
- Efficient Database Queries: Uses optimized SQL queries and indexing to ensure fast data retrieval.
- Modular Classes: Core logic is organized into classes such as DatabaseManager, User, Account, StatusService, FeedController, and ErrorManager for maintainability and scalability.
- Global Error Handling: Centralized logging and exception management via the
ErrorManagersingleton. - Accessible Dashboard UI: Collapsible status feeds expose synchronized ARIA states, scoped form controls, and responsive footer spacing so navigation and content remain usable across assistive technologies and compact screens.
| Feature | Summary | |
|---|---|---|
| βοΈ | Architecture |
|
| π© | Code Quality |
|
| π | Documentation |
|
| π | Integrations |
|
| π§© | Modularity |
|
| π | Security |
|
|
βββ /
βββ README.md
βββ docker/
βββ root
βββ vendor/
βββ composer.json
βββ composer.lock
βββ config.php
βββ cron.php
βββ install.sql
βββ app/
β βββ Core/
β βββ Controllers/
β βββ Models/
β βββ Views/
βββ public/
βββ assets/
βββ images/
βββ index.php
βββ install.phpThe code under root/app follows an MVC pattern with Controllers, Models, and Views. Shared framework classes live in the Core directory.
To access the database connection within the application, retrieve the singleton instance of the DatabaseManager class:
use App\Core\DatabaseManager;
$db = DatabaseManager::getInstance();The router is exposed as a singleton. Use the shared instance to dispatch requests:
use App\Core\Router;
Router::getInstance()->dispatch($method, $uri);This ensures the underlying FastRoute dispatcher is constructed only once.
Manage sessions through the SessionManager singleton:
use App\Core\SessionManager;
$session = SessionManager::getInstance();
$session->start(); // Start or resume a session
$session->set('name', 'value');
$value = $session->get('name');
$session->regenerate(); // Regenerate ID after loginCall $session->destroy(); to end the session during logout.
Before getting started with the installation, ensure your runtime environment meets the following requirements:
- Web Server: Apache
- Programming Language: PHP 8.0+
- Database: MySQL 8.0+ or compatible MariaDB
Install the project using the following steps:
-
Upload Files:
- Upload all the project files to your hosting server.
-
Set Webroot:
- Set the
publicfolder as the webroot directory on your hosting server.
- Set the
-
Update Configuration:
- Open
root/config.phpand update the necessary variables, including MySQL database credentials. - Optionally adjust
CRON_MAX_EXECUTION_TIMEandCRON_MEMORY_LIMITto control how long the cron script runs and how much memory it can use.
- Open
-
Install Database:
- For fresh installations: Navigate to
/install.phpin your browser. The script will create all tables with the latest schema and a default admin user. - For upgrades from old schema: Navigate to
/upgrade.phpin your browser. The script will migrate your existing database to the new structure while preserving all data. Make sure to backup your database before upgrading!
- For fresh installations: Navigate to
-
Default Login:
- Use the default login credentials:
adminfor both username and password.
- Use the default login credentials:
-
Set Up Cron Jobs:
- Configure cron to call the guarded worker entry points (all four tasks also support the single-argument form if you prefer direct execution):
0 0 * * * /usr/bin/php /PATH-TO-APP/cron.php worker daily 5 0 * * * /usr/bin/php /PATH-TO-APP/cron.php worker fill-queue */10 * * * * /usr/bin/php /PATH-TO-APP/cron.php worker run-queue 0 0 1 * * /usr/bin/php /PATH-TO-APP/cron.php worker monthly
- Replace
/PATH-TO-APP/with the actual path to your installation. - The
workerprefix acquires a PID-based lock for the specific task being launched. That guarantees only one instance of a given job flag runs at once while still allowing the other workers to execute concurrently. When the guard succeeds,run-queueis spawned as a background process so the cron entry returns immediately. - On hosts that cannot spawn background processes, call the single-argument form directly (for example,
php cron.php run-queue).run-queuestill respects its per-flag lock when invoked inline and drains all due jobs before exiting. - daily: runs cleanup tasks (purge statuses, images, IPs)
- fill-queue: adds future job slots for the current day without truncating existing jobs
- run-queue: executes due jobs (
scheduled_at <= now) and enforces a single retry before permanent failure - monthly: resets API usage counters (run on the 1st of each month)
The queue uses a lean status_jobs table purpose-built for cron orchestration:
CREATE TABLE status_jobs (
id CHAR(36) PRIMARY KEY,
scheduled_at BIGINT NOT NULL,
account VARCHAR(255) NOT NULL,
username VARCHAR(255) NOT NULL,
status ENUM('pending','retry') NOT NULL DEFAULT 'pending'
);
CREATE INDEX idx_scheduled ON status_jobs (scheduled_at, status);
CREATE UNIQUE INDEX idx_unique_job ON status_jobs (account, username, scheduled_at);- fill-queue runs once daily to append the next 24 hours of work, including hours earlier in the day so
run-queuecan catch up after delays, while leaving existing rows untouched. - run-queue runs frequently to process records where
scheduled_at <= NOW(). Each invocation drains all due retry jobs before moving to pending jobs and repeats until neither queue has work remaining. Successful jobs are deleted. A first failure updates the row tostatus = 'retry'; a second failure deletes the job permanently. statusonly tracks whether the job is on its original attempt (pending) or retrying (retry). There is no long-lived worker loopβcron cadence controls execution.
Login as admin with the password admin. Follow these steps:
-
Create or Change Users:
- Navigate to the User tab.
- Add or update user details as needed.
-
Create Status Campaigns:
- Go to the Account tab.
- Click on Add/Update New Account.
- Fill in the following details:
- Account Name
- Platform
- Prompt
- Link
- Image Instructions
- Days
- Post Schedule
- Include Hashtags
- Click Add/Update.
Statuses are generated on schedule and added to the respective account feed and the user's collective omni feed. Use the feed with tools like IFTTT to update social media.
The docker directory contains a Dockerfile and docker-compose.yml for running the project locally. Start the containers with:
docker compose upThis launches an Apache web server and MariaDB instance with configuration values taken from the compose file. Adjust the environment variables there to set API keys and database credentials.
The db service allows an empty MariaDB root password by setting MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: '1'. If you want a password instead, set MYSQL_ROOT_PASSWORD and update DB_PASSWORD in the web service.
- Switched feed URLs to
/feeds/{user}/{account}and/feeds/{user}/all. - Added rewrite for new feed paths under
/feeds/{user}/{account}. - Updated navigation links to use the new structure.
- Moved RSS feed generation into
FeedControllerand removedrss-lib.php. - Added type hints across the codebase and improved error propagation.
- Improved error logging for RSS feed generation.
- Refactored API interactions into
StatusService. - Various security fixes and bug improvements.
This project is licensed under the MIT License.
