承接 rpurinton/phpack 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

rpurinton/phpack

最新稳定版本:1.0.7

Composer 安装命令:

composer create-project rpurinton/phpack

包简介

A tool to modularize and compile PHP and HTML components.

README 文档

README

PHPack is a powerful tool designed to help you modularize and compile your PHP and HTML components into a single, optimized PHP file. This enhances the organization and maintainability of your web projects.

Features

  • Modular Design: Break down your web pages into reusable components for better code management.
  • JSON Configuration: Define your page structure using intuitive JSON files.
  • Automatic Compilation: Seamlessly compile your components into a single PHP file for easy deployment.

Installation

Via Composer (Recommended)

To install PHPack using Composer, simply run:

composer require rpurinton/phpack

This will make the phpack command available globally, allowing you to use it in any project.

Manual Installation

If you prefer to install PHPack manually, you can clone the repository and set up the executable:

git clone https://github.com/rpurinton/phpack.git
cd phpack
sudo chmod +x phpack && sudo cp phpack /usr/bin/

Usage

  1. Create Your Components: Organize your PHP and HTML components in the parts directory.
  2. Define Page Structure: Use JSON files in the pages directory to define the structure of your web pages.
  3. Run PHPack: Execute the phpack script to compile your pages.
phpack

Example

Directory Structure

Here's an example of how you can structure your project:

yourproject/
├── pages/
│   ├── home.json
│   ├── about.json
│   ├── contact.json
│   └── blog.json
└── parts/
    ├── head/
    │   ├── head.json
    │   ├── meta.html
    │   ├── styles.html
    │   └── scripts.html
    ├── body/
    │   ├── header.html
    │   ├── footer.html
    │   ├── content/
    │   │   ├── intro.html
    │   │   ├── features.html
    │   │   └── testimonials.html
    │   ├── about.html
    │   ├── contact.html
    │   └── blog/
    │       ├── post1.html
    │       ├── post2.html
    │       └── post3.html

JSON Example

home.json

{
    "parts": [
        "<html lang=\"en\">",
        "head/head.json",
        "<body>",
        "body/header.html",
        "body/content.json",
        "body/footer.html",
        "</body></html>"
    ]
}

The above example would result in the creation of:

yourproject/
└── public/
    ├── home.php
    ├── about.php
    ├── contact.php
    └── blog.php

You can use the public folder as your web root for your web server. A part can be either .html, .php, text/html, or another .json file that includes more parts.

License

This project is licensed under the MIT License.

Contributing

We welcome contributions from the community! Feel free to submit issues or pull requests.

Contact

For more information, please contact Russell Purinton.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-28