wpstarter/framework
WPStarter Framework is a Laravel-inspired PHP framework for building WordPress apps and plugins with modern patterns. It provides familiar helpers, service container features, and a clean structure to speed development while staying compatible with WordPress.
Post::whereNull('status')).WP_User|null).null issues in WordPress hooks/filters (e.g., $_POST data).#[\Route(...)] in Laravel 11).TypeError in Laravel’s dependency injection when binding WordPress services.create_function in WordPress plugins).get_post_meta() returning null).TypeError if not updated. Mitigate by:
@phpstan-ignore-line or runtime checks.wpstarter:validate Artisan command (if added in future releases).| Risk Area | Severity (Updated) | Mitigation Strategy |
|---|---|---|
| PHP 8.4 Migration | Medium | Test with PHPUnit + phpstan; use php -dzend_extension=opcache.so for JIT tuning. |
| Type Collisions | High | Audit WordPress hooks with declare(strict_types=1) in Laravel service providers. |
| Legacy Plugin Conflicts | High | Isolate WordPress plugins in a separate Composer vendor or use autoload-dev. |
| Caching Inconsistencies | Medium | Configure Laravel’s cache to serialize WordPress transients with json_encode(). |
| Database Schema Conflicts | Medium | Use Laravel’s Schema::table('wp_posts') for migrations; avoid wpdb for new tables. |
ramsey/collection for nullable types)?declare(strict_types=1) globally in Laravel, or only in hybrid layers (e.g., app/WpStarter)?call_user_func_array) interact with PHP 8.4’s stricter type system?mu-plugins)?wp-settings.php is unoptimized.null assertions (e.g., assertNull() instead of assertFalse())?E_DEPRECATED for old WordPress functions)?APP_STRICT_MODE=true in .env) to catch type issues early.#[Hook('init')]
public function onWordPressInit(): void { ... }
global $wpdb; with typed bindings:
$wpdb = app(\WPStarter\Database\WPDB::class);
wpstarter:generate-types (if added) to scaffold nullable type hints for WordPress models.public function findPost(int|string $id): ?Post { ... }
wp_* tables to use Laravel’s strict schema validation.Phase 0: PHP 8.4 Readiness (New)
wpstarter/framework.Dockerfile/php.ini to PHP 8.4:
FROM laravel/php84:latest
composer require --dev phpstan/phpstan and audit:
phpstan analyse --level 8 app/WpStarter
$meta = get_post_meta($post_id, 'key', true) ?? null;
Phase 1: Decoupled Coexistence (Updated)
wpstarter.php:
'php_version' => '8.4',
'strict_types' => true,
APP_DEBUG=false in production to hide WordPress’s E_DEPRECATED warnings.Phase 2: Feature Integration (Updated)
#[Hook('wp_loaded', priority: 100)]
public function cacheWordPressData(): void { ... }
public function getUserData(int $id): array|false { ... }
WP_* classes.composer.json:
"require": {
"php": "^8.4",
"wpstarter/framework": "^1.10.0"
}
wp-cli/wp-cli (if used) via:
composer why-not wp-cli/wp-cli
wp-includes/load.php).wpstarter:check-compatibility (if added) to validate.# Example for Laravel Sail
sail build --no-cache --php-version=8.4
wpstarter/framework with PHP 8.4 flags:
composer require wpstarter/framework --with-all-dependencies
php.ini:
zend.assertions = -1 # Disable assertions for WordPress compatibility
How can I help you explore Laravel packages today?