evgip/w3a
Composer 安装命令:
composer create-project evgip/w3a
包简介
A custom modular PHP MVC forum matching the HMVC pattern.
README 文档
README
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.
🚀 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
- Create a MySQL database:
CREATE DATABASE w3a CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
- Import the schema:
mysql -u your_username -p w3a < db/schema.sql
- 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
- Admin: admin@example.com / password
- User: test@test.ru / password
📁 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 profilesstories- News stories (URL or text)comments- Threaded commentsvotes- Upvotes/downvotessessions- Active user sessionsaudit_logs- Administrative activity logdomains- Banned domains listflags- Complaint log
See db/schema.sql for complete schema.
🤝 Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
- Author: Evg
- Repository: https://github.com/evgip/w3a
- Issues: https://github.com/evgip/w3a/issues
⭐ If you find this project useful, please consider giving it a star on GitHub!
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-18


