npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-thinkphp

v0.2.50

Published

Yeoman generator for thinkphp

Downloads

19

Readme

Thinkphp Generator | Thinkphp 生成器

利用yeoman自动构建thinkphp应用 - 通过命令行自动创建应用以及 Controller/Model/View.

English Doc

使用方法

安装 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是指你自定义应用的名称

自动生成器

已支持的生成器:

App

创建新的 ThinkPHP 应用并使用 Composer.

Example:

yo thinkphp

Controller

为你的应用自动生成新的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>

Model

和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';

}

Space

为你的应用生成新的命名空间. 命名空间是指thinkphp应用中例如Home/Admin等文件夹

Example:

yo thinkphp:space Admin

生成 Application/Admin 文件夹以及初始内容.

  • Admin
    • Common
    • Conf
    • Controller
    • Model
    • View
    • index.html

Serve

运行本地的php测试服务器,此功能例如php自带的测试服务器实现.

Example:

yo thinkphp:serve

你的测试服务器运行在 127.0.0.1:3000.

关于

Thinkphp的命令行自动构建工具,类似 Laravelphp artisan

许可证

MIT