wpdiggerstudio/wpzylos-core
Composer 安装命令:
composer require wpdiggerstudio/wpzylos-core
包简介
Core foundation for WPZylos framework - PluginContext, Application, ServiceProvider, and base utilities for building WordPress plugins
关键字:
README 文档
README
The foundation package for WPZylos framework. Provides core interfaces, context management, and base classes for building WordPress plugins with modern architecture.
📖 Full Documentation | 🐛 Report Issues
✨ Features
- ContextInterface — Plugin identity contract that survives PHP-Scoper
- PluginContext — Default implementation with prefixing, paths, hooks, options, transients, cron, meta keys, and asset handles
- Application — Plugin kernel with PSR-11 container and service provider lifecycle
- ServiceProvider — Base class for modular service registration with convenience methods
- Paths — Path and URL resolution with named aliases and
@aliassyntax - CacheRepository — Context-prefixed caching via WordPress object cache + transient fallback
- Utilities —
Arr(dot-notation array helpers) andStr(string manipulation) classes
📋 Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.0 |
| WordPress | 6.0+ |
🚀 Installation
composer require KYNetCode/wpzylos-core
📖 Quick Start
use WPZylos\Framework\Core\Application; use WPZylos\Framework\Core\PluginContext; // Create plugin context $context = PluginContext::create([ 'file' => __FILE__, 'slug' => 'my-plugin', 'prefix' => 'myplugin_', 'textDomain' => 'my-plugin', 'version' => '1.0.0', 'namespace' => 'MyPlugin', ]); // Create and boot application $app = new Application($context); $app->register(new MyServiceProvider()); $app->boot();
🏗️ Core Components
PluginContext
Holds plugin identity and configuration:
$context = PluginContext::create([ 'file' => __FILE__, 'slug' => 'my-plugin', 'prefix' => 'myplugin_', 'textDomain' => 'my-plugin', 'version' => '1.0.0', 'namespace' => 'MyPlugin', ]); // Identity $context->slug(); // 'my-plugin' $context->prefix(); // 'myplugin_' $context->textDomain(); // 'my-plugin' $context->version(); // '1.0.0' $context->namespace(); // 'MyPlugin' // Prefixed keys $context->optionKey('setting'); // 'myplugin_setting' $context->hook('init'); // 'myplugin_init' $context->transientKey('cache'); // 'myplugin_cache' $context->cronHook('daily_sync'); // 'myplugin_daily_sync' $context->metaKey('order_id'); // '_myplugin_order_id' $context->assetHandle('admin-js'); // 'my-plugin-admin-js' $context->tableName('orders'); // 'wp_myplugin_orders'
Application
Plugin kernel that manages service providers and the DI container:
$app = new Application($context); // Register service providers $app->register(new DatabaseServiceProvider()); $app->register(new RoutingServiceProvider()); // Boot the application $app->boot(); // Resolve services from the container $service = $app->make(MyService::class); // Check if a service is bound $app->has(MyService::class); // true/false
ServiceProvider
Base class for modular service registration:
use WPZylos\Framework\Core\ServiceProvider; use WPZylos\Framework\Core\Contracts\ApplicationInterface; class MyServiceProvider extends ServiceProvider { public function register(ApplicationInterface $app): void { parent::register($app); $this->singleton(MyService::class, function () { return new MyService($this->context()); }); } public function boot(ApplicationInterface $app): void { // Called after all providers are registered $service = $this->make(MyService::class); } }
Paths
Path resolution with named aliases and @alias syntax:
$paths = $app->paths(); // Use built-in aliases $paths->path('@views/welcome.php'); // /plugin/resources/views/welcome.php $paths->url('@assets/css/app.css'); // https://.../resources/assets/css/app.css // Register custom aliases (chainable) $paths->alias('templates', 'resources/templates'); // Check existence $paths->exists('@config/app.php'); // true/false // Plugin uploads directory $paths->uploads('invoices/1.pdf'); // .../wp-content/uploads/my-plugin/invoices/1.pdf
CacheRepository
Context-prefixed caching with WordPress object cache and transient fallback:
use WPZylos\Framework\Core\Cache\CacheRepository; $cache = new CacheRepository($context); // Object cache $cache->put('key', 'value', 3600); $cache->get('key'); // 'value' $cache->forget('key'); // Remember pattern $users = $cache->remember('active_users', 3600, function () { return get_users(['role' => 'subscriber']); }); // Transient fallback (persistent across requests) $cache->transientPut('license', $data, DAY_IN_SECONDS); $cache->transientGet('license'); $cache->transientRemember('api_data', HOUR_IN_SECONDS, fn() => fetch_api());
📦 Related Packages
| Package | Description |
|---|---|
| wpzylos-container | PSR-11 dependency injection |
| wpzylos-config | Configuration management |
| wpzylos-hooks | WordPress hook management |
| wpzylos-scaffold | Plugin template |
📖 Documentation
For comprehensive documentation, tutorials, and API reference, visit wpzylos.com.
☕ Support the Project
📄 License
MIT License. See LICENSE for details.
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Made with ❤️ by KYNetCode
wpdiggerstudio/wpzylos-core 适用场景与选型建议
wpdiggerstudio/wpzylos-core 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.42k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「plugin」 「mvc」 「wordpress」 「application」 「service-provider」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wpdiggerstudio/wpzylos-core 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wpdiggerstudio/wpzylos-core 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wpdiggerstudio/wpzylos-core 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
CakePHP 4.x AdminLTE Theme.
Kinikit - PHP Application development framework MVC component
Plugin for YOURLS. Default tools to use in some laemmi plugins
Small extensible framework in PHP
Oauth 2 client for Ubiquity framework
统计信息
- 总下载量: 1.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-31