akirk / wp-app
A lightweight framework for building web applications on WordPress with routing, admin bar integration, and theme isolation
Installs: 12
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/akirk/wp-app
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.7
- wp-coding-standards/wpcs: ^3.0
README
Build modern web applications on WordPress with routing, admin bar integration, and theme isolation.
Why WordPress for Web Applications?
WordPress isn't just for blogs. It's a powerful foundation for web applications.
For developers:
- Built-in User Management - Authentication, roles, and permissions out of the box
- Admin Interface - Professional backend without building from scratch
- Security & Updates - Automatic security patches and proven practices
- Global Ready - Built-in i18n and multisite support
For users:
- Universal Hosting - Deploy anywhere WordPress runs, from shared hosting to cloud
- Familiar Environment - Manage your app alongside your existing WordPress site
Try it Now
Try the examples instantly in your browser with WordPress Playground:
- Minimal App - The simplest possible WpApp
- Community App - Full-featured example with database, REST API, and admin integration
Features
- URL Routing - Pattern-based routing with WordPress rewrite rules
- Theme Isolation - Clean HTML output separate from your WordPress theme
- Admin Bar Integration - WordPress-style navigation for your app
- Access Control - WordPress capability-based authentication
- BaseApp Pattern - Structured architecture for complex applications
- BaseStorage Pattern - Database abstraction with schema management using
dbDelta
Quick start
You can use this command to scaffold your new plugin:
composer create-project akirk/create-wp-app my-app
Which gives you this little wizard:
Creating WpApp plugin: my-app
----------------------------------------
Plugin name [My App]:
Namespace [MyApp]:
Author []:
URL path [my-app]:
Setup type:
[1] Minimal - simple WpApp setup
[2] Full - with BaseApp structure
Choose [1]:
✓ Updated plugin-name.php
✓ Updated templates/index.php
✓ Renamed plugin-name.php to my-app.php
✓ Removed src/ directory (not needed for minimal setup)
✓ Updated composer.json
✓ Cleaned up setup scripts
Done! Your plugin is ready.
Next steps:
Option A: Run locally with WordPress Playground
npx @wp-playground/cli@latest server --auto-mount=my-app --login
Option B: Install in WordPress
1. Activate the plugin in WordPress
2. Visit /my-app/ to see your app
Which gives you something like this:
Which you can then build on by adding your own routes, modify templates, etc.
Installation
composer require akirk/wp-app
Quick Start
The simplest possible WpApp requires just 3 lines:
<?php /** * Plugin Name: Minimal App */ require_once __DIR__ . '/vendor/autoload.php'; use WpApp\WpApp; $app = new WpApp( __DIR__ . '/templates', 'minimal' ); $app->init();
Create templates/index.php:
<!DOCTYPE html> <html <?php echo wp_app_language_attributes(); ?>> <head> <title><?php echo wp_app_title( 'My App' ); ?></title> <?php wp_app_head(); ?> </head> <body> <?php wp_app_body_open(); ?> <h1>Welcome to My App!</h1> <?php wp_app_body_close(); ?> </body> </html>
Your app is now available at /minimal!
Local Development
Run your plugin locally without a full WordPress installation:
npx @wp-playground/cli@latest server --auto-mount --login
This starts a local WordPress instance with your plugin mounted and activated.
Documentation
| Topic | Description |
|---|---|
| Getting Started | Installation, quick start, template functions |
| Configuration | All configuration options |
| Routing | URL patterns, parameters, templates |
| Masterbar | Admin bar customization |
| Access Control | Capabilities, roles, permissions |
| BaseApp Pattern | Structured architecture for larger apps |
| Tutorial | Step-by-step guide from minimal to full-featured |
Claude Code Integration
Get AI assistance for WpApp development in Claude Code:
/plugin marketplace add akirk/wp-app /plugin install wpapp@wp-app
Examples
Minimal Example
See examples/minimal-app/ - The simplest possible WpApp (3 lines of code)
Community App Example
See examples/community-app/ - Full BaseApp pattern demonstration with:
- BaseStorage with schema management
- User progress tracking
- REST API endpoints
- Admin integration
Requirements
- PHP 7.4 or higher
- WordPress 5.0 or higher
WordPress Coding Standards
This package follows WordPress coding standards. Run PHPCS:
composer phpcs
License
GPL-2.0-or-later