
Security News
TeamPCP Is Systematically Targeting Security Tools Across the OSS Ecosystem
TeamPCP is targeting security tools across the OSS ecosystem, turning scanners and CI pipelines into infostealers to access enterprise secrets.
generator-thinkphp
Advanced tools
利用yeoman自动构建thinkphp应用 - 通过命令行自动创建应用以及 Controller/Model/View.
安装 Composer 关于 composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
安装 yo and generator-thinkphp 关于 Yeoman
npm install -g yo generator-thinkphp
cd 进入到你的工作文件夹以进行下一步操作:
cd [workPlace]
workPlace是指你平时写代码的文件夹
输入 yo thinkphp 来生成应用,根据指引输入,你可以自定义应用名称,如果你未安装 Composer 会有提示是否自动安装:
yo thinkphp
输入 cd [appName] 进入你的应用目录,开始一下步操作:
cd [appName]
appName是指你自定义应用的名称
已支持的生成器:
Example:
yo thinkphp
为你的应用自动生成新的Controller. 例如 yo thinkphp:controller [classedName] [spaceName].
classedName 为必选项,不能为空.
spaceName 默认为 Home ,可选项.
Example:
yo thinkphp:controller Index Home
此命令生成 Application/Home/Controller/IndexController.class.php:
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
//
$this->display();
}
}
以及 Application/Home/View/Index/index.html:
<extend name="base" />
<block name="content">
<h1>Index</h1>
</block>
以及 Application/Home/View/Index/base.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Home</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
</head>
<body>
<block name="content"></block>
</body>
</html>
和Controller命令基本一样, 为你的应用自动生成新的Model.
Example:
yo thinkphp:model User Home
生成 Application/Home/Model/UserModel.class.php:
<?php
namespace Home\Model;
use Think\Model;
class UserModel extends Model {
//
protected $tableName = 'User';
}
为你的应用生成新的命名空间. 命名空间是指thinkphp应用中例如Home/Admin等文件夹
Example:
yo thinkphp:space Admin
生成 Application/Admin 文件夹以及初始内容.
运行本地的php测试服务器,此功能例如php自带的测试服务器实现.
Example:
yo thinkphp:serve
你的测试服务器运行在 127.0.0.1:3000.
Thinkphp的命令行自动构建工具,类似 Laravel 的 php artisan
FAQs
Yeoman generator for thinkphp
The npm package generator-thinkphp receives a total of 2 weekly downloads. As such, generator-thinkphp popularity was classified as not popular.
We found that generator-thinkphp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
TeamPCP is targeting security tools across the OSS ecosystem, turning scanners and CI pipelines into infostealers to access enterprise secrets.

Security News
TypeScript 6.0 introduces new standard APIs, modern default settings, and deprecations as it prepares projects for the upcoming TypeScript 7.0 release.

Security News
/Research
Newly published Trivy Docker images (0.69.4, 0.69.5, and 0.69.6) were found to contain infostealer IOCs and were pushed to Docker Hub without corresponding GitHub releases.