mxcro/makermaker-core
Composer 安装命令:
composer require mxcro/makermaker-core
包简介
Core library for scaffolding TypeRocket CRUD applications
README 文档
README
Core library for scaffolding TypeRocket CRUD applications in WordPress.
Installation
composer require mxcro/makermaker-core
Usage
Creating a Client Plugin
Use the maker:client command to scaffold a new client plugin:
php galaxy maker:client "Client Name" --slug=client-slug --org=your-org
This creates a thin plugin with:
- Composer dependency on makermaker-core
- Bootstrap with
Boot::init() - Client service provider
- Config overrides
- Modules and resources directories
Manual Setup
- Require in composer.json:
{
"require": {
"mxcro/makermaker-core": "^1.0"
}
}
- Bootstrap in plugin.php:
require __DIR__ . '/vendor/autoload.php'; add_action('plugins_loaded', function () { \MakerMaker\Boot::init([ 'plugin_dir' => __DIR__, 'plugin_url' => plugin_dir_url(__FILE__), 'modules_path' => __DIR__ . '/modules', 'config_path' => __DIR__ . '/config', 'views_path' => __DIR__ . '/resources/views', ]); \YourNamespace\Providers\ClientServiceProvider::register(); }, 20);
- Create ClientServiceProvider:
namespace YourNamespace\Providers; class ClientServiceProvider { public static function register(): void { add_filter('makermaker/config', [self::class, 'configOverrides'], 10, 2); self::loadResources(); } public static function configOverrides(array $config, array $paths): array { // Override config return $config; } protected static function loadResources(): void { // Load TypeRocket resources } }
Features
CRUD Generation
Generate complete CRUD with Model, Controller, Policy, Fields, Views, and Resources:
php galaxy make:crud Product --template=standard php galaxy make:crud Order --module=shop --template=api-ready
Module Discovery
Automatically loads modules from configured path:
modules/
├── shop/
│ ├── module.php
│ ├── module.json
│ ├── Models/
│ ├── Controllers/
│ └── resources/
Template Variants
Three built-in variants:
simple: Basic CRUD without REST endpointsstandard: Full CRUD with admin interfaceapi-ready: CRUD with REST API endpoints
Configuration
Override via config/makermaker.php:
return [ 'templates' => [ 'default_variant' => 'api-ready', ], 'crud' => [ 'default_module' => null, ], ];
Architecture
Core Library (this package):
- Commands (
make:crud,maker:client) - Helpers (String, Database, Validation, etc.)
- Templates (simple, standard, api-ready)
- Module discovery
- Config management
- Boot initialization
Client Plugins:
- Models, Controllers, Policies, Fields
- Modules with domain logic
- TypeRocket resources
- Views
- Client-specific config
Requirements
- PHP ^8.2
- TypeRocket Pro v6
- WordPress 5.9+
License
GPL-2.0-or-later
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2025-10-31