adzadzadz/wp-plugin-framework
Composer 安装命令:
composer require adzadzadz/wp-plugin-framework
包简介
Modern MVC framework for WordPress plugin development - Build professional plugins with clean architecture
README 文档
README
Operation CWAL (Can't Wait Any Longer) - Start building WordPress plugins RIGHT NOW with modern MVC architecture.
🚀 Why This Framework?
You're a developer. You love MVC. You hate WordPress's procedural chaos.
This framework is for developers who:
- ✅ Can't Wait Any Longer to start building professional WordPress plugins
- ✅ Love working with MVC architecture instead of procedural spaghetti code
- ✅ Want to start writing plugins immediately without setup hassle
- ✅ Demand modern PHP practices in WordPress development
- ✅ Need professional structure for scalable plugin development
⚡ Operation CWAL - Instant Plugin Development
# Install via Composer (FASTEST) composer create-project adzadzadz/wp-plugin-framework my-awesome-plugin # Start coding IMMEDIATELY cd my-awesome-plugin
That's it. You're ready to build.
🎯 Built for MVC Lovers
Clean Controller Structure
<?php namespace App\Controllers; use AdzWP\Core\Controller; class MyAwesomeController extends Controller { public $actions = [ 'init' => 'initialize', 'admin_menu' => 'setupAdminMenu' ]; public function initialize() { // Your plugin logic here - NO HOOKS MESS! } }
Elegant Database Models
<?php namespace App\Models; use AdzWP\Db\Model; class Post extends Model { protected $table = 'posts'; protected $fillable = ['title', 'content', 'status']; // ORM-style relationships and queries public function comments() { return $this->hasMany(Comment::class); } }
Fluent Query Builder
$posts = $this->queryBuilder() ->select(['id', 'title', 'content']) ->from('posts') ->where('status', 'published') ->orderBy('created_at', 'DESC') ->limit(10) ->get();
🏗️ Framework Architecture
src/
├── AdzMain.php # Global \Adz framework access
├── Core/ # Core framework components
│ ├── Controller.php # MVC Controller base class
│ ├── Model.php # MVC Model base class
│ ├── Service.php # Service layer base class
│ ├── Config.php # Configuration management
│ └── View.php # Template rendering
├── Db/ # Database layer
│ ├── Model.php # ORM-style database models
│ ├── QueryBuilder.php # Fluent query interface
│ └── Connection.php # Database connection
└── Helpers/ # Utility classes
├── ArrayHelper.php # Array manipulation utilities
└── RESTHelper.php # REST API utilities
🎪 Features That Make You Productive
🔥 Instant Setup
- Zero configuration - Works out of the box
- PSR-4 autoloading - Modern PHP standards
- Composer ready - Professional dependency management
🏗️ Professional Architecture
- MVC pattern - Separate concerns like a pro
- Service layer - Reusable business logic with dependency injection
- Auto-hook registration - Methods automatically become WordPress hooks
- Automatic admin pages -
adminPage{Name}()methods create admin pages automatically - Context-aware methods -
admin{Name}()andfrontend{Name}()run only where needed - ORM-style models - Database interactions made easy
- Dependency injection - Clean, testable code
- Event system - WordPress hooks without the mess
🧪 Testing Ready
- 61 unit tests included - Quality guaranteed
- PHPUnit integration - Professional testing workflow
- WordPress mocks - Test without WordPress overhead
📦 Developer Experience
- IDE friendly - Full autocompletion and navigation
- Modern namespaces -
AdzWP\Core\*,AdzWP\Db\* - Global framework access - Simple
\Adz::config()calls
🚀 Quick Start Example
1. Create Your Plugin Structure
// my-plugin.php <?php /** * Plugin Name: My Awesome Plugin * Description: Built with ADZ Framework - Operation CWAL! */ require_once 'vendor/autoload.php'; // Initialize framework $framework = \Adz::config(); $framework->set('plugin.path', __DIR__); // Load your controllers new App\Controllers\MyAwesomeController();
2. Build Your Controller (Auto-Hook Registration)
// src/Controllers/MyAwesomeController.php <?php namespace App\Controllers; use AdzWP\Core\Controller; class MyAwesomeController extends Controller { // Methods starting with 'action' are automatically registered as WordPress actions public function actionWpInit() { if ($this->isAdmin()) { $this->setupAdminInterface(); } } public function actionWpAjaxMyAction() { $data = ['message' => 'Hello from ADZ Framework!']; wp_send_json_success($data); } // Methods starting with 'filter' are automatically registered as WordPress filters public function filterTheTitle($title, $post_id) { return $title . ' (Enhanced)'; } /** * Use priority parameter for custom priority (recommended) */ public function actionAdminMenu($priority = 20) { // This runs with priority 20 // WordPress receives 0 arguments (priority param excluded) add_menu_page('My Plugin', 'My Plugin', 'manage_options', 'my-plugin', [$this, 'renderPage']); } /** * Automatic admin page creation - creates menu and handles display * @page_title My Plugin Settings * @menu_title Settings * @icon_url dashicons-admin-settings */ public function adminPageSettings() { echo '<div class="wrap">'; echo '<h1>My Plugin Settings</h1>'; echo '<p>This admin page was created automatically!</p>'; echo '</div>'; } /** * Admin-only method - runs only in WordPress admin */ public function adminInitializeSettings() { register_setting('my_plugin_settings', 'my_plugin_option'); } /** * Frontend-only method - runs only on site frontend */ public function frontendEnqueueScripts() { wp_enqueue_script('my-plugin-frontend', 'script.js'); } }
3. Create Your Services
// src/Services/UserService.php <?php namespace App\Services; use AdzWP\Core\Service; class UserService extends Service { public function getDisplayName(int $userId): string { $user = get_userdata($userId); return $user ? ($user->display_name ?: $user->user_login) : 'Unknown User'; } public function updateUserMeta(int $userId, string $key, $value): bool { if (!get_userdata($userId)) { return false; } return update_user_meta($userId, $key, $value) !== false; } }
4. Use Services in Controllers
class MyController extends Controller { public function actionWpInit() { // Initialize services new \App\Services\UserService(); } public function actionUserRegister($userId) { // Access service via magic property $displayName = $this->userService->getDisplayName($userId); // Update user meta via service $this->userService->updateUserMeta($userId, 'welcome_sent', true); } }
5. Create Your Models
// src/Models/CustomPost.php <?php namespace App\Models; use AdzWP\Db\Model; class CustomPost extends Model { protected $table = 'custom_posts'; protected $fillable = ['title', 'content', 'meta']; public function save(): bool { // Your save logic here return true; } }
📊 Why Developers Choose ADZ Framework
| Traditional WordPress | ADZ Framework |
|---|---|
| 🤮 Procedural spaghetti | 🎯 Clean MVC architecture |
| 🐌 Manual hook management | ⚡ Automatic hook registration |
| 😵 Global function chaos | 🏗️ Organized namespaces |
| 🔧 Manual setup hell | 🚀 Instant productivity |
| 🐛 Hard to test | 🧪 Test-driven development |
🎯 Operation CWAL Targets
- ✅ Plugin MVP in under 30 minutes
- ✅ Professional plugin architecture from day 1
- ✅ Zero WordPress procedural code
- ✅ Testable, maintainable, scalable
- ✅ Modern PHP development experience
📚 Documentation & Support
- Complete Documentation - Comprehensive framework guide
- Services Guide - Service layer and dependency injection
- Auto-Hook Registration - Automatic WordPress hook registration
- Controller Automatic Methods - Admin pages, admin/frontend methods
- Quick Start Guide - Get building immediately
- API Reference - Full framework reference
- Plugin Lifecycle - Install/uninstall hooks
- Dependency Management - Automatic plugin installation
- Controllers Guide - MVC controller patterns
- First Plugin Tutorial - Complete working example
- Unit Tests - 61 tests, 85 assertions, 100% pass rate
🔧 Requirements
- PHP 7.4+ (Modern PHP features)
- WordPress 5.0+ (Latest WordPress APIs)
- Composer (Dependency management)
📈 Framework Stats
- ✅ 61 Unit Tests - Quality guaranteed
- ✅ 85 Assertions - Thoroughly tested
- ✅ 100% Pass Rate - Production ready
- ✅ PSR-4 Compliant - Modern standards
- ✅ Zero Dependencies - Lightweight core
🎪 Get Started NOW
# Operation CWAL - Deploy immediately! composer create-project adzadzadz/wp-plugin-framework my-plugin cd my-plugin # Start building your WordPress plugin empire! 🚀
Built for developers who Can't Wait Any Longer to create amazing WordPress plugins with professional MVC architecture.
ADZ Framework - Because WordPress development should be enjoyable, not painful.
adzadzadz/wp-plugin-framework 适用场景与选型建议
adzadzadz/wp-plugin-framework 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「php」 「plugin」 「mvc」 「wordpress」 「development」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 adzadzadz/wp-plugin-framework 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 adzadzadz/wp-plugin-framework 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 adzadzadz/wp-plugin-framework 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
CakePHP 4.x AdminLTE Theme.
Plugin for YOURLS. Default tools to use in some laemmi plugins
Alfabank REST API integration
High-performance, opinionated PHP 8 web framework with O(1) routing, parallel async MySQL, type-safe asset bridge, and React-island frontend
Allows polling user for event dates and times.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2025-08-22