adzadzadz / wp-plugin-framework
Modern MVC framework for WordPress plugin development - Build professional plugins with clean architecture
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/adzadzadz/wp-plugin-framework
Requires
- php: >=7.4
Requires (Dev)
- doctrine/instantiator: ^1.5.0
- mockery/mockery: ^1.4
- phpunit/phpunit: ^9.0
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.