定制 evgip/w3a 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

evgip/w3a

Composer 安装命令:

composer create-project evgip/w3a

包简介

A custom modular PHP MVC forum matching the HMVC pattern.

README 文档

README

🇷🇺 Русский | 🇬🇧 English

A modern, lightweight news aggregator built with PHP 8.1+ and MySQL, inspired by Hacker News and Lobster. Features a modular HMVC architecture, real-time updates, and comprehensive moderation tools.

PHP Version MySQL License

W3A home

W3A admin

W3A setting

🚀 Features

Core Functionality

  • News Stories - Submit and browse news stories with URL or text content
  • Comments - Threaded comment system with nested replies
  • Voting System - Upvote/downvote stories and comments with real-time updates
  • User Authentication - Secure registration, login, and session management
  • User Profiles - Activity tracking, submitted stories, and comment history

Advanced Features

  • Real-time Updates - AJAX-powered live updates for votes and comments
  • Moderation Tools - Ban users, domains, and manage content
  • Audit Logging - Comprehensive activity tracking for all administrative actions
  • Rate Limiting - Protection against abuse with configurable limits
  • CSRF Protection - Security tokens for all form submissions
  • Soft Deletes - Recoverable content deletion
  • Search - Full-text search across stories and comments

User Experience

  • Responsive Design - Mobile-friendly interface
  • Dark Mode - System-aware theme switching
  • Keyboard Shortcuts - Power-user navigation
  • Markdown Support - Rich text formatting in comments

🛠️ Technology Stack

Component Technology
Backend PHP 8.1+ (no framework, custom HMVC)
Database MySQL 8.0+ with PDO
Frontend Vanilla JavaScript, CSS3
Architecture Modular HMVC pattern
Security CSRF tokens, rate limiting, password hashing (bcrypt)
Server Apache/Nginx with mod_rewrite

📦 Installation

Install the package through Composer.

Requirements

  • PHP 8.1 or higher
  • MySQL 8.0 or higher
  • Apache/Nginx with URL rewriting enabled
  • Composer (optional, for development)

Step 1: Clone Repository

git clone https://github.com/evgip/w3a.git
cd w3a

Step 2: Configure Database

  1. Create a MySQL database:
CREATE DATABASE w3a CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  1. Import the schema:
mysql -u your_username -p w3a < db/schema.sql
  1. Update database credentials in app/Config/config.phpp:
'database' => [
	'host' => 'MySQL-8.2',
	'port' => '3306',
	'dbname' => 'soc',
	'username' => 'root',
	'password' => '',
	'charset' => 'utf8mb4',
]

Step 3: Configure Application

Edit app/Config/config.php:

'app' => [
	'name' => 'w3a',
	'url' => 'http://soc.local',
	'lang' => en', 

Step 4: Set Permissions

chmod -R 755 storage/
chmod -R 755 public/

Step 5: Configure Web Server

Apache (.htaccess already included):

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

Nginx:

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Step 6: Login information

📁 Project Structure

w3a/
├── app/
│	├── Config/                 # Configuration
│   │	└── config.php          # App settings
│   ├── Core/                   # Core framework classes
│   │   ├── Router.php          # URL routing
│   │   ├── Controller.php      # Base controller
│   │   ├── Model.php           # Base model
│   │   ├── Database.php        # PDO wrapper
│   │   ├── Auth.php            # Authentication
│   │   ├── Session.php         # Session management
│   │   ├── Request.php         # HTTP request handling
│   │   ├── Response.php        # HTTP responses
│   │   ├── View.php            # Template rendering
│   │   ├── Audit.php           # Audit logging
│   │   └── Validator.php       # Input validation
│   │
│   └── Modules/                 # Feature modules (HMVC)
│       ├── Auth/               # Authentication module
│       │   ├── Controllers/
│       │   ├── Models/
│       │   ├── Views/
│       │   └── routes.php
│       ├── Stories/            # News stories module
│       ├── Comments/           # Comments module
│       ├── Votes/              # Voting system
│       ├── Users/              # User profiles
│       ├── Moderation/         # Moderation tools
│       ├── Origins/            # Domain management
│       └── Api/                # REST API
├── public/                      # Public assets
│   ├── index.php              # Entry point
│   ├── css/                   # Stylesheets
│   ├── js/                    # JavaScript files
│   └── images/                # Images
│
├── storage/                     # Writable storage
│   ├── logs/                  # Application logs
│   └── cache/                 # Cache files
│
├── db/                          # Database
│   └── schema.sql             # Database schema
│
└── README.md                    # This file

🔒 Security Features

  • Password Hashing - bcrypt with automatic salt
  • CSRF Protection - Token validation on all forms
  • SQL Injection Prevention - Prepared statements (PDO)
  • XSS Protection - Output escaping with htmlspecialchars()
  • Rate Limiting - Configurable per-action limits
  • Session Security - HTTP-only cookies, regeneration
  • Input Validation - Server-side validation for all inputs

🧪 Development

Debug Mode

Enable in app/Config/config.php:

'env' => 'development', // development или production

📊 Database Schema

Core Tables

  • users - User accounts and profiles
  • stories - News stories (URL or text)
  • comments - Threaded comments
  • votes - Upvotes/downvotes
  • sessions - Active user sessions
  • audit_logs - Administrative activity log
  • domains - Banned domains list
  • flags - Complaint log

See db/schema.sql for complete schema.

🤝 Contributing

Contributions are welcome! Please follow these steps:

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

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Inspired by the functionality of Hacker News and Lobster
  • Speed and simplicity of the HLEB framework
  • Built with vanilla PHP (no frameworks)
  • Modular HMVC architecture

📧 Contact

⭐ If you find this project useful, please consider giving it a star on GitHub!

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-18