wp-starter/contracts
Laravel/PHP contract interfaces for a WordPress starter kit. Defines shared abstractions to keep packages decoupled and implementations swappable, providing a lightweight base for building WordPress integrations in a Laravel-style architecture.
Illuminate\Contracts, Laravel\Sanctum, Laravel\Nova) is incompatible with WordPress’s WP_* classes or hooks. The package does not appear to provide Laravel-compatible interfaces (e.g., Repository, ServiceProvider, or Http\Contracts).ServiceProvider or Package manifest, making it unclear how to register contracts in Laravel’s DI container. Laravel’s config/app.php and config/contracts.php expectations won’t align.wp_* tables (e.g., wp_posts, wp_users), while Laravel uses conventional naming (e.g., users, posts). Migrations or Eloquent models would need manual overrides.bind() or singleton() methods won’t recognize WordPress’s add_action/add_filter hooks or WP_Hook classes. Contracts would need to be rewritten to fit Laravel’s Interface-based DI system.WP_User to App\Models\User) would require significant refactoring.UserContract, PostContract) are needed? Are they for API resources, business logic, or database access?Illuminate\Contracts\Auth\Authenticatable, etc.).Interface-based system.WP_User → Authenticatable).Illuminate\Contracts\*) or packages like spatie/laravel-contracts.Repository patterns, hook-based logic).App\Contracts\UserRepository).Illuminate\Contracts.WP_User → User model.Macro or Trait to extend Eloquent models with WordPress methods.config/app.php or a custom ContractsServiceProvider.// app/Providers/ContractsServiceProvider.php
public function register()
{
$this->app->bind(
\App\Contracts\UserRepository::class,
\App\Repositories\WordPressUserRepository::class
);
}
wp_* schema is not compatible with Laravel’s migrations. Solutions:
wp_authenticate_user() vs. Laravel’s Auth::attempt(). Requires a custom guard or adapter.add_action('init', ...); Laravel uses Route::get(). A middleware/hook bridge may be needed.transients vs. Laravel’s cache(). Implement a cache adapter.UserContract, PostContract).User).WP_User changes).Illuminate\Contracts changes).WP_Error) won’t integrate cleanly with Laravel’s exception handling (\Illuminate\Contracts\Container\BindingResolutionException).WP_Error → HttpResponse).add_action) adds overhead. Laravel’s service container is lighter.WP_Query is less efficient than Laravel’s Eloquent.| Failure Scenario | Impact | Mitigation |
|---|---|---|
How can I help you explore Laravel packages today?