wpdiggerstudio/wpzylos-core 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wpdiggerstudio/wpzylos-core

最新稳定版本:v1.0.0

Composer 安装命令:

composer require wpdiggerstudio/wpzylos-core

包简介

Core foundation for WPZylos framework - PluginContext, Application, ServiceProvider, and base utilities for building WordPress plugins

README 文档

README

PHP Version License GitHub

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, options
  • Application — Plugin kernel with service provider registration
  • ServiceProvider — Base class for modular service registration
  • Paths — Path resolution with named aliases
  • Utilities — Arr and Str helper classes

📋 Requirements

Requirement Version
PHP ^8.0
WordPress 6.0+

🚀 Installation

composer require wpdiggerstudio/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',
]);

// Create and boot application
$app = new Application($context);
$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',
]);

// Access properties
$context->slug();       // 'my-plugin'
$context->prefix();     // 'myplugin_'
$context->textDomain(); // 'my-plugin'
$context->version();    // '1.0.0'

// Prefix helpers
$context->prefixedOption('setting');  // 'myplugin_setting'
$context->prefixedHook('init');       // 'myplugin_init'

Application

Plugin kernel that manages service providers:

$app = new Application($context);

// Register service providers
$app->register(new DatabaseServiceProvider());
$app->register(new RoutingServiceProvider());

// Boot the application
$app->boot();

// Access the container
$service = $app->get(MyService::class);

ServiceProvider

Base class for modular service registration:

class MyServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->bind(MyService::class, function ($app) {
            return new MyService($app->get('config'));
        });
    }

    public function boot(): void
    {
        // Called after all providers registered
    }
}

Paths

Path resolution with named aliases:

$paths = new Paths(__DIR__);

// Register aliases
$paths->alias('views', 'resources/views');
$paths->alias('config', 'config');

// Resolve paths
$paths->get('views');        // /plugin/resources/views
$paths->get('config/app');   // /plugin/config/app

📦 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

If you find this package helpful, consider buying me a coffee! Your support helps maintain and improve the WPZylos ecosystem.

Donate with PayPal

📄 License

MIT License. See LICENSE for details.

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Made with ❤️ by WPDiggerStudio

统计信息

  • 总下载量: 479
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 14
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-31