Download the PHP package kynetcode/wpzylos-scaffold without Composer
On this page you can find all versions of the php package kynetcode/wpzylos-scaffold. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kynetcode/wpzylos-scaffold
More information about kynetcode/wpzylos-scaffold
Files in kynetcode/wpzylos-scaffold
Package wpzylos-scaffold
Short Description Template repository for creating production-ready WPZylos-based WordPress plugins with MVC architecture, dependency injection, and PHP-Scoper namespace isolation
License GPL-2.0-or-later
Homepage https://github.com/KYNetCode/wpzylos-scaffold
Informations about the package wpzylos-scaffold
WPZylos Scaffold
Template repository for creating production-ready WordPress plugins with MVC architecture and PHP-Scoper namespace isolation.
๐ Full Documentation | ๐ Report Issues
โจ Features
- Complete MVC Structure โ Controllers, Services, Views, Routes
- PSR-4 Autoloading โ Modern PHP namespace organization
- PHP-Scoper Ready โ Pre-configured namespace isolation for multi-plugin compatibility
- Service Providers โ Modular dependency injection
- Database Migrations โ Version-controlled schema changes
- WordPress Compliant โ Proper headers, MIT license, readme.txt
- Intelligent CLI โ Version prompting, smart file discovery, auto-versioning
- Build Pipeline โ Scaffold CLI with QA checks and ZIP creation
- Security First โ Nonce verification, capability checks, input sanitization
- DaisyUI v5 + Tailwind v4 โ Modern CSS framework with scoped prefix
- Vue.js 3 (Options API) โ Reactive admin UI components out of the box
- React 19 (Opt-in) โ Swap to React with a single config change
- Vite Build System โ
npm run dev(HMR) /npm run build(production) - Dark Mode Toggle โ DaisyUI theme switching ready
- Shortcode Support โ Example shortcode with Vue/React mount point
๐ Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.0 |
| WordPress | 6.0+ |
| Composer | 2.0+ |
| WP-CLI | Optional |
๐ Quick Start
Option 1: Use as GitHub Template
Click "Use this template" on GitHub to create a new repository.
Option 2: Composer Create Project
Option 3: Clone and Customize
Initialize Your Plugin (Recommended)
After creating your project, run the Scaffold CLI to customize and manage your plugin.
Option 1: PowerShell (Windows 10/11)
Open Windows PowerShell (search "PowerShell" in Start menu):
Option 2: Command Prompt (Windows)
Open Command Prompt (cmd.exe). Since .ps1 files don't run directly in cmd, use:
Option 3: Bash (Linux/Mac/Git Bash)
For Linux, macOS, or Git Bash on Windows (install Git for Windows):
Git Bash alternative: If
./scaffold.shdoesn't work, trybash scaffold.sh
The intelligent init script handles all scenarios:
| Scenario | Behavior |
|---|---|
| Fresh install | Detects my-plugin.php, uses scaffold defaults |
| Re-configure | Loads .plugin-config.json, shows current values as defaults |
| Config deleted | Auto-detects plugin from *.php with "Plugin Name:" header |
| Partial update | Only changes modified values, shows "Skipped" for unchanged |
Features:
- Version Prompting: Sets initial version and updates plugin header + PluginContext
- Namespace support: Supports nested namespaces like
WPDigger\WPBraCalculator - Config-aware defaults: Reuses existing
.plugin-config.jsonvalues for identity, build include lists, CSS prefix, and integrity update settings. - Canonical bootstrap: Main plugin and uninstall entrypoints use
PluginContext::forPluginFile(__FILE__)and delegate lifecycle work toapp/Core/Plugin.php.
๐ Project Structure
๐ง Customization
Automated (Recommended)
Run the Scaffold CLI for automated setup:
PowerShell:
Command Prompt:
Linux/Mac/Git Bash:
Manual
If you prefer manual customization, perform search and replace:
| Find | Replace With | Description |
|---|---|---|
my-plugin |
your-plugin |
Plugin slug (lowercase, hyphenated) |
my_plugin |
your_plugin |
Scoper prefix (lowercase, underscored) |
MyPlugin |
YourPlugin |
PHP namespace (PascalCase) |
myplugin_ |
yourplugin_ |
Database/option prefix |
My Plugin |
Your Plugin |
Display name |
Files to Update
your-plugin.phpโ Plugin headers, PluginContext configurationcomposer.jsonโ Package name, namespace in autoloadscoper.inc.phpโ Scoper prefix variable.plugin-config.jsonโ Created by init, used by builduninstall.phpโ Context configuration
๐๏ธ Core Components
PluginContext
The PluginContext class (app/Core/PluginContext.php) is the single source of truth for plugin identity. All framework components use this for prefixing.
Available Methods:
| Method | Returns | Example |
|---|---|---|
slug() |
Plugin slug | your-plugin |
prefix() |
Database prefix | yourplugin_ |
textDomain() |
Translation domain | your-plugin |
version() |
Plugin version | 1.0.0 |
file() |
Main plugin file path | /path/to/your-plugin.php |
path($relative) |
Absolute path | /path/to/your-plugin/config/ |
url($relative) |
Plugin URL | https://site.com/wp-content/plugins/your-plugin/ |
hook($name) |
Prefixed hook name | yourplugin_custom_hook |
optionKey($key) |
Prefixed option key | yourplugin_settings |
transientKey($key) |
Prefixed transient key | yourplugin_cache |
cronHook($name) |
Prefixed cron hook | yourplugin_daily_task |
tableName($name) |
Full table name | wp_yourplugin_orders |
metaKey($key) |
Prefixed meta key | _yourplugin_data |
assetHandle($handle) |
Asset handle | your-plugin-main |
Helper Functions
Global helpers available after bootstrap (app/Support/helpers.php):
โ๏ธ Configuration
config/app.php
Service Providers
The bootstrap (bootstrap/app.php) registers framework service providers in dependency order:
- ConfigServiceProvider โ Configuration and .env loading
- I18nServiceProvider โ Internationalization
- HookServiceProvider โ WordPress hook management
- SecurityServiceProvider โ Nonce, Gate, Sanitizer
- HttpServiceProvider โ Request, Response, Pipeline
- ValidationServiceProvider โ Input validation
- ViewsServiceProvider โ Template rendering
- DatabaseServiceProvider โ Database connection
- MigrationsServiceProvider โ Schema migrations
- RoutingServiceProvider โ URL routing
- WpCliServiceProvider โ WP-CLI commands (when available)
๐ค๏ธ Routing
Define routes in routes/web.php:
๐จ Frontend Build Pipeline
The scaffold includes a modern frontend stack powered by Vite, DaisyUI v5, and Tailwind CSS v4.
Install Dependencies
Development (HMR)
Starts Vite dev server with Hot Module Replacement. Define WPZYLOS_VITE_DEV in wp-config.php to load dev assets:
Production Build
Outputs optimized assets to dist/ with a manifest for ViteAssetResolver.
Switching Between Vue and React
The scaffold ships with Vue.js 3 (Options API) by default. To switch to React 19:
- In
vite.config.js, comment outvue()and uncommentreact() - Update your admin entry point to import
AdminApp.jsxinstead ofAdminApp.vue
CSS Prefix Derivation
The init scripts automatically derive a DaisyUI CSS prefix from your plugin slug (e.g., my-plugin โ mp-). This prevents CSS collisions when multiple WPZylos plugins run on the same site.
The scaffold ships with PHP/Twig view support through wpzylos-views. Blade template examples are intentionally not included because the views package does not provide a Blade engine.
Shortcode Example
The scaffold includes a shortcode example that mounts a Vue/React component on the frontend via JsMount::shortcodeMount().
๐จ Build & Release
Development
Production Build
Use the Scaffold CLI for production builds:
Windows (PowerShell):
Windows (Command Prompt):
Linux/Mac (or Git Bash):
The build script will:
- Clean previous build artifacts
- Run
phpcbf --standard=PSR12(code style fix) - Run
phpstan analyze(static analysis) - Install production dependencies
- Run PHP-Scoper for namespace isolation
- Copy required files & rebuild autoloader
- Remove development files
- Create versioned ZIP in
dist/
Note: The build script reads configuration from
.plugin-config.json(created byscaffold init).
Intelligent Features:
- Smart File Discovery: Automatically detects project files/folders and prompts for unknown items
- Preference Persistence: Saves your include/exclude choices for future builds
- Auto-Versioning: Suggests next patch version based on existing ZIP files in
dist/ - Artifact Preservation: Preserves the
dist/directory with previous builds
The production build creates a zip file at dist/your-plugin-1.0.0.zip ready for deployment.
PHP-Scoper
The scaffold includes pre-configured PHP-Scoper (scoper.inc.php) that:
- Prefixes all vendor namespaces for multi-plugin isolation
- Excludes WordPress core functions, classes, and constants
- Excludes your plugin's namespace
- Generates unique build prefixes using git hash
๐งช Testing
Tests are located in tests/Unit/. The test bootstrap is at tests/bootstrap.php.
๐ Security
The scaffold implements WordPress security best practices:
- Nonce verification in form submissions
- Capability checks for user permissions
- Prepared statements for database queries
- Output escaping with proper functions
- Input sanitization before processing
See the Security Package for detailed security utilities.
๐ Troubleshooting
Composer create-project fails
Namespace/autoloader issues
Verify composer.json PSR-4 namespace matches your class namespace.
PHP-Scoper errors
Check scoper.inc.php and ensure WordPress functions are excluded.
Built plugin crashes
Verify WordPress symbols are excluded in scoper configuration.
๐ฆ Related Packages
| Package | Description |
|---|---|
| wpzylos-core | Application foundation |
| wpzylos-container | PSR-11 dependency injection container |
| wpzylos-config | Configuration management |
| wpzylos-routing | URL routing system |
| wpzylos-database | Database abstraction |
| wpzylos-migrations | Database migrations |
| wpzylos-hooks | WordPress hook management |
| wpzylos-security | Security utilities |
| wpzylos-validation | Input validation |
| wpzylos-views | Template rendering |
| wpzylos-http | HTTP request/response |
| wpzylos-i18n | Internationalization |
| wpzylos-wp-cli | WP-CLI integration |
๐ Documentation
For comprehensive documentation, tutorials, and API reference, visit wpzylos.com.
โ Support the Project
If you find this scaffold helpful, consider supporting the WPZylos ecosystem!
๐ License
This project is licensed under the MIT License. See LICENSE for details.
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Made with โค๏ธ by KYNetCode
All versions of wpzylos-scaffold with dependencies
kynetcode/wpzylos-config Version ^1.0
kynetcode/wpzylos-container Version ^1.0
kynetcode/wpzylos-core Version ^1.0
kynetcode/wpzylos-database Version ^1.0
kynetcode/wpzylos-hooks Version ^1.0
kynetcode/wpzylos-http Version ^1.0
kynetcode/wpzylos-i18n Version ^1.0
kynetcode/wpzylos-migrations Version ^1.0
kynetcode/wpzylos-routing Version ^1.0
kynetcode/wpzylos-security Version ^1.0
kynetcode/wpzylos-validation Version ^1.0
kynetcode/wpzylos-views Version ^1.0