krypt0nn/php-blueprints

1.0.0 2021-08-18 08:06 UTC

This package is auto-updated.

Last update: 2024-09-18 14:46:45 UTC


README

php-blueprints 是一个可以使您生活更轻松的库

此库提供创建 html/php 蓝图并在其他文件中使用它们的功能

安装

composer require krypt0nn/php-blueprints

示例

文件 input/blank.php

<html>
    <head>
        <title>Example blueprint</title>
    </head>

    <body>
        @section(body)
    </body>
</html>

文件 input/index.php

@include(blank)

@section(body)
    <p>Hello, World!</p>
    <p>Hello, World!</p>
    <p>Hello, World!</p>
    <p>Hello, World!</p>
@end

运行此代码

<?php

require 'vendor/autoload.php';

use Blueprints\Blueprints;

Blueprints::processDir (__DIR__ .'/input', __DIR__ .'/output');

然后在 output 文件夹中会出现文件 index.php,其内容如下

<html>
    <head>
        <title>Example blueprint</title>
    </head>

    <body>
        <!-- @section(body) -->
        <p>Hello, World!</p>
        <p>Hello, World!</p>
        <p>Hello, World!</p>
        <p>Hello, World!</p>
    </body>
</html>

您可以在 test 文件夹中看到此示例


作者: Nikita Podvirnyy