phycticio/wp-boilerplate
最新稳定版本:v1.0.17
Composer 安装命令:
composer create-project phycticio/wp-boilerplate
包简介
WordPress boilerplate with Composer, easier configuration, and an improved folder structure
README 文档
README
Modern template for WordPress development with scalable architecture and updated technology stack.
Key Features
- 🚀 Modern Stack: PHP 8.1+, Node 18+, Composer 2+, pnpm
- 🧩 Dependency Management:
- Plugins managed via Composer
- Assets with Webpack 5 and ES6+
- 🧱 Block Theme:
- Native blocks with React
- Full Site Editing (FSE)
- Complete frontend/backend integration
- 📐 Clean Architecture:
- MVC pattern with Twig templating
- Environment-based configuration
- Clear separation of responsibilities
- ⚙️ Professional Workflow:
- Integrated GitHub Actions
- PHP Code Standards (Pint)
- Multi-environment Webpack
Prerequisites
- PHP 8.1+
- Node.js 18+
- Composer 2.2+
- pnpm 8+
Quick Installation
composer create-project phycticio/wp-boilerplate project-name
cd project-name
cp sample.env .env
pnpm install
pnpm run build
Configuration
Environments
- Edit
.envwith your variables - Configure environments in
config/environments/development.php: Local configproduction.php: Production config
Main Files
config/application.php: Shared configurationweb/wp-config.php: WordPress Bootstrapapp/App.php: Theme initializer
Directory Structure
wp-boilerplate/
├── .github/ # GitHub Actions workflows
├── app/ # Application logic
│ ├── Features/ # Traits and functionalities
│ ├── Hooks/ # WordPress hooks
│ ├── Services/ # Services and DB interactions
│ └── App.php # Main initializer
├── config/ # Configurations
│ ├── environments/ # Environment variables
│ ├── application.php # Base config
│ └── webpack.*.js # Webpack configurations
├── resources/ # Assets and templates
│ ├── blocks/ # Custom blocks
│ ├── scripts/ # JS entry points
│ ├── scss/ # Global styles
│ └── views/ # Twig templates
├── web/ # Web root
│ ├── content/ # WP content directory
│ └── wp/ # Core WordPress
└── [config files] # Global configurations
Development
Main Commands
# Install dependencies pnpm install # Development with hot-reload pnpm run dev # Production build pnpm run build # Lint PHP pnpm run lint # Format code pnpm run format
Block Creation
- Add new block in
resources/blocks/ - Use WordPress
registerBlockType - Import styles/scripts in Webpack config
Twig Templates
// Example usage in WordPress View::render('template-name', ['data' => $values]);
GitHub Actions Workflow
- Lint: PHP/JS code verification
- Build: Asset compilation
- Deploy: Configurable for different environments
Coding Standards
- PHP: PHP-CS-Fixer (config in
pint.json) - JS: ESLint with standard config
- Styles: SCSS with SMACSS structure
Contribution
- Fork the project
- Create feature branch (
feat/my-feature) - Submit Pull Request
License
GPL-3.0. See LICENSE for details.
Changelog
See CHANGELOG.md for version history.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-13