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.
Application PHP source lives inside the root directory, primarily in root/app and root/public. Runtime dependencies for the application are managed under root/composer.json and root/vendor, while tooling, tests, and repo-level Composer metadata live at the repository root. Container setup sits in the docker 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.
- Two-Tier APCu Caching: High-performance caching layer (L1: in-memory static, L2: APCu persistent) dramatically reduces database queries and filesystem I/O. Models cache user info, account data, and status feeds. RSS feed XML output is cached for instant delivery. Image metadata is cached to eliminate up to 99% of filesystem operations. Fully configurable via
CACHE_ENABLEDandCACHE_TTL_*constants. - Modular Classes: Core logic is organized into classes such as DatabaseManager, User, Account, StatusService, FeedController, CacheService, 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 |
|
|
βββ /
βββ CHANGELOG.md
βββ MIGRATION.md
βββ README.md
βββ composer.json
βββ composer.lock
βββ docker/
β βββ Dockerfile
β βββ docker-compose.yml
βββ root/
β βββ config.php
β βββ composer.json
β βββ composer.lock
β βββ cron.php
β βββ install.sql
β βββ upgrade.sql
β βββ app/
β β βββ Core/
β β βββ Controllers/
β β βββ Models/
β β βββ Views/
β βββ public/
β β βββ assets/
β β βββ images/
β β βββ index.php
β β βββ install.php
β β βββ upgrade.php
β βββ vendor/
βββ tests/
βββ vendor/The 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.2+
- 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. - Timezone Configuration (IMPORTANT): Set
DEFAULT_TIMEZONEto your local timezone to ensure scheduled posts run at the correct times. Examples:'America/New_York','America/Los_Angeles','Europe/London','UTC'. See PHP Timezones for the full list. This setting ensures that when you schedule a post for 7am, it runs at 7am in YOUR timezone, not UTC. - Optionally adjust
CRON_MAX_EXECUTION_TIMEandCRON_MEMORY_LIMITto control how long the cron script runs and how much memory it can use. - Cache Configuration (Optional): APCu caching is enabled by default with sensible TTL values. Configure via environment variables or edit these constants in
config.php:CACHE_ENABLED(default: true) - Master switch for APCu cachingCACHE_TTL_USER(default: 300s) - User info cache lifetimeCACHE_TTL_ACCOUNT(default: 600s) - Account data cache lifetimeCACHE_TTL_STATUS(default: 60s) - Status data cache lifetimeCACHE_TTL_FEED(default: 180s) - RSS feed and image metadata cache lifetime
- Note: If APCu extension is not available, the system automatically falls back to in-memory caching for the current request only.
- 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: clears queued jobs and adds all scheduled job slots for the current day
- 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',
processing BOOLEAN NOT NULL DEFAULT FALSE
);
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 clear existing rows and append the current day's scheduled work, including hours earlier in the day.
- 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.processingis flipped totruewhen a worker claims a job and reset tofalsewhen work completes or a stale job is released, preventing duplicate workers from acting on the same row.
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.
