PHPackages                             phper666/generate-file - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phper666/generate-file

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phper666/generate-file
======================

phper666 generate-file Component

v1.0.3(5y ago)08.4k↑320%2MITPHPPHP &gt;=7.0

Since Nov 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/phper666/generate-file)[ Packagist](https://packagist.org/packages/phper666/generate-file)[ RSS](/packages/phper666-generate-file/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)DependenciesVersions (5)Used By (2)

### 功能说明

[](#功能说明)

1、能替换某个项目下的所有文件内容
2、能复制原目录文件生成一个内容被替换过新的项目

### 使用

[](#使用)

```
composer require phper666/generate-file:~1.0
```

### 例子

[](#例子)

```
namespace Phper666\GenerateFile;
require "GenerateFile.php";
$gf = new GenerateFile();

// 要替换的参数 key为文件名称、目录名称、文件内容，value为要替换的值
$params = [
    'wxapp-template' => 'wxapp-test',
    'wxapp_template' => 'wxapp_test',
    'WxappTemplate' => 'WxappTest',
];

// 设置要处理的目录，必须要绝对路径,并且目录一定要存在
$dir = '/app/www/TmgAdminBE/tmg-addons-stub/wxapp-template';

$gf->setDefaultParams()  // 初始化参数，主要是为了解决常驻内存单例的问题
    ->setReplaceDir($dir) // 设置处理的目录
    ->setReplaceParams($params) // 设置要替换的参数
    ->setProjectName('wxapp-test') // 设置生成新的项目名称，为空则不会生成新的项目，会默认替换当前项目的文件、目录、文件内容，如果设置了项目名称，则不会修改当前目录，会copy一份新的项目，并且替换新的项目文件内容
    ->setReplaceFileName(true) // 是否开启文件名称替换，开启后会自动替换文件的名称，不会替换目录的名称
    ->setReplaceFileExt(['*']) // 设置支持替换文件的后缀，默认替换项目下的所有的文件
    ->run();

echo true;
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~101 days

Total

4

Last Release

2119d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b407cc3d7bba8b0301c2b93ab80a1872d5a2568ea1c6199ab8a05311df6c83a0?d=identicon)[phper666](/maintainers/phper666)

---

Top Contributors

[![phper666](https://avatars.githubusercontent.com/u/26764098?v=4)](https://github.com/phper666 "phper666 (2 commits)")[![lphkxd](https://avatars.githubusercontent.com/u/16346895?v=4)](https://github.com/lphkxd "lphkxd (1 commits)")

---

Tags

phpphper666generate-file

### Embed Badge

![Health badge](/badges/phper666-generate-file/health.svg)

```
[![Health](https://phpackages.com/badges/phper666-generate-file/health.svg)](https://phpackages.com/packages/phper666-generate-file)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21623.4k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
