PHPackages                             liuqiandev/thinkphp-facade-generator - 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. [Framework](/categories/framework)
4. /
5. liuqiandev/thinkphp-facade-generator

ActiveThink-extend[Framework](/categories/framework)

liuqiandev/thinkphp-facade-generator
====================================

thinkphp-facade-generator for thinkphp 5.1.\*

v1.0.3(6y ago)5105MITPHPPHP &gt;=7.1.0

Since Mar 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/liuqiandev/thinkphp-facade-generator)[ Packagist](https://packagist.org/packages/liuqiandev/thinkphp-facade-generator)[ RSS](/packages/liuqiandev-thinkphp-facade-generator/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (5)Used By (0)

thinkphp门面类自动生成工具
=================

[](#thinkphp门面类自动生成工具)

> 一款可以将指定类的动态方法生成thinkphp门面类的命令行工具

### 版本依赖

[](#版本依赖)

```
thinkphp 5.1.*

php >= 7.1.0

```

### 如何安装

[](#如何安装)

```
composer require liuqiandev/thinkphp-facade-generator

```

此外，你还需要在你的`application/command`中，绑定一下命令

```
return [
    //你的其他命令行
    'make:appFacade'=>\liuqiandev\thinkphp_facade_generator\AppFacade::class,
];

```

### 如何使用

[](#如何使用)

在命令行执行以下命令即可

```
php think make:appFacade 指定类的完整命名空间
    //可选参数
    --path self

```

### 注意事项

[](#注意事项)

```
* @method mixed set(string $name, mixed $value, int $expire = null) static 设置缓存

```

这是thinphp内置组件Cache的门面中的一个方法注解，它包含几大部分，如果你需要生成的类中包含以下内容，生成的注解也是和上面的格式一致。

##### 返回类型

[](#返回类型)

目前支持的返回类型包括php内置的ReturnType、对象和self

```
public function method():int
public function method():string
public function method():float
public function method():array
public function method():self
public function method():object
public function method():Class

```

若未设置，则会默认选择`mixed`

> tips:如果你需要链式操作，如Facade::a()-&gt;b(),则你的a()必须返回self

##### 变量类型 Type Hinting

[](#变量类型-type-hinting)

和上面的返回类型差不多，自己去实验一下即可。

##### 文字注释 DocComment

[](#文字注释-doccomment)

文字注释必须是 `@desc 文字注释`或`@description 文字注释`

#### Bug反馈

[](#bug反馈)

Issue，改不改看心情。

6.0的等我开始用了再考虑。

#### 使用实例

[](#使用实例)

如下的动态类：

```
