evert/phpincludes

PHPIncludes 会遍历您的源代码并自动创建一个 'includes' 文件。

0.2.0 2013-06-21 14:14 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:55:33 UTC


README

这是一个简单的脚本,它遍历您的源代码并尝试创建一个 'includes' 文件。

使用包含文件(例如,与自动加载相比)可以带来显著的性能优势。

安装

{
    "require" : {
        "evert/phpincludes" : "~0.2"
    }
}

这将把包安装到 vendor/evert/phpincludes,并在 vendor/bin 中创建一个符号链接。我倾向于这样做

{
    "require" : {
        "evert/phpincludes" : "~0.2"
    },
    "config" : {
        "bin-dir" : "bin"
    }
}

因此,我的项目所有 bin 文件都在一个本地的 bin/ 目录中。在我的个人系统中,我还有一个 ~/bin/ 目录(在我的家中),并使用 composer 安装各种 PHP 工具。

使用方法

phpincludes [--php52] [-v] <directory> [outputfile]

  <directory>
    This is the directory that will be scanned for PHP files.

  [outputfile]
    Outputfile is the file PHPIncludes writes to. If it's not specified, it will
    be sent to STDOUT

    If the output file already exists, it will attempt to update the existing
    includes file. It does so by looking at two markers in the file:

    // Begin includes\n
    and
    // End includes\n

    Every before '// Begin includes\n' will be retained, as well as everything
    after '// End includes\n'. Everything in between will be overwritten. The
    \n is a unix newline.

  --php52

    By default every include will be prefixed with the __DIR__ constant, so that
    every line looks like:

    include __DIR__ . '/File.php';

    If the php52 option is supplied, the __DIR__ constant is not used, but
    instead every file will be prefixed with dirname(__FILE__).

  -v
    The verbose option will show a lot of debugging output.

待办事项

  • 忽略没有类或接口的文件,这些需要添加
  • 允许检查具有除 .php 之外扩展名的文件