Skip to content
wpstarterPublic

About

The WpStarter Framework - Laravel Framework for WordPress

Topics

Resources

Stars

16 stars

Watchers

3 watching

Forks

Repository files navigation

WpStarter Framework

WpStarter is a Laravel port for WordPress. It brings Laravel-style application structure, dependency injection, routing, Eloquent, Blade views, validation, caching, queues, and other framework services into WordPress, with integrations for its hooks, content, and admin menus.

This repository contains the wpstarter/framework Composer package. To build an application, start with the WpStarter application skeleton.

Version mapping

WpStarter Laravel baseline
1.x 8.x
2.x 12.x

WpStarter 2.x requires PHP 8.2 or later. See composer.json for the PHP extensions and dependencies required by this checkout.

The mapping identifies the Laravel version the port is based on. WordPress integration and WpStarter-specific changes mean it is not a guarantee that every Laravel package or example works unchanged.

Namespaces and helpers

Illuminate becomes WpStarter

Framework classes use the WpStarter namespace in place of Laravel's Illuminate namespace. For example:

Laravel WpStarter
Illuminate\Http\Request WpStarter\Http\Request
Illuminate\Database\Eloquent\Model WpStarter\Database\Eloquent\Model
Illuminate\Support\Facades\Cache WpStarter\Support\Facades\Cache
Illuminate\Support\ServiceProvider WpStarter\Support\ServiceProvider

When adapting Laravel code, update imports and type hints. Packages that depend directly on Illuminate classes may need additional adaptation.

Laravel-style helpers use ws_

Laravel-style global helpers are prefixed with ws_ to reduce naming conflicts in the WordPress environment:

Laravel WpStarter
app() ws_app()
config() ws_config()
view() ws_view()
route() ws_route()
request() ws_request()
redirect() ws_redirect()
cache() ws_cache()
__() ws___()
use WpStarter\Support\Facades\Cache;

$name = ws_config('app.name');
$value = Cache::get('example');

return ws_view('dashboard', ['name' => $name, 'value' => $value]);

WordPress integration also provides helpers such as ws_admin_url(), ws_admin_notice(), ws_enqueue_js(), and ws_enqueue_css().

WordPress integration

Three routing contexts

Choose the route facade for the context you are targeting:

Context Route facade Matching behavior
HTTP routes WpStarter\Support\Facades\Route Request URL and HTTP method
WordPress content routes WpStarter\Wordpress\Facades\Route Shortcode tag in the current singular post and HTTP method
WordPress admin routes WpStarter\Wordpress\Admin\Facades\Route Registered admin menu screen and HTTP method

WordPress content routes use the route URI as a shortcode tag and expose shortcode attributes as route parameters. Admin routes define menus and submenus with titles, capabilities, icons, and positions.

Views and responses

Alongside the standard ws_view() helper, WordPress response helpers let a controller target different parts of WordPress rendering:

  • wp_view() creates a full-page view response.
  • content_view() creates a post-content view response.
  • shortcode_view() creates a shortcode view response.
  • ws_pass() lets WordPress continue handling the request.

Documentation

Use the Laravel documentation matching the version mapping above as a starting point: Laravel 8.x for WpStarter 1.x and Laravel 12.x for WpStarter 2.x. Adapt namespaces and helper names, and verify WordPress-specific behavior against the installed WpStarter source.

Guidance for coding agents and a source map are available in AGENTS.md.

License

WpStarter is open-source software licensed under the MIT license.

About

The WpStarter Framework - Laravel Framework for WordPress

Topics

Resources

Stars

16 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages