Download the PHP package daijulong/generator without Composer

On this page you can find all versions of the php package daijulong/generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package generator

Generator

适用于PHP项目的代码生成工具

环境要求

安装

通过 Composer

composer.json

重要:安装好后须进行资源发布

执行发布命令后将在当前工作目录生成 generator , generator.json ,resources/stubs 等文件资源

使用

将显示使用手册

命令手册

显示 命令的使用手册

所有支持的命令,加上 选项即显示该命令的使用手册

生成文件示例

以下内容以默认发布的资源(配置)为依据演示,命令相关说明请依照命令行手册

示例:生成的资源名称为: Admin/UserAuth

将会依次生成以下文件:

  1. app/Http/Controllers/Admin/UserAuthController.php

  2. app/Models/Admin/UserAuth.php

  3. resources/views/admin/user_auth/index.php

  4. resources/views/admin/user_auth/create.php

  5. resources/views/admin/user_auth/edit.php

  6. resources/views/admin/user_auth/show.php

上述文件生成规则皆由配置文件 中定义的规则来决定

资源名称建议以类名为准,遵循 psr-4 规范

配置

配置文件为 ,生成规则在此定义

resources-path

定义资源目录名称,默认为 resources ,内含模板目录 stubs

modules

定义 命令中所支持的模块的默认设置,如 controller 模块的定义:

模块字段说明:

confirm : true 或 false ,生成该模块文件前是否需要确认

confirm-default : 确认默认值,yes 或 no

override : 如果文件已经存在,是否覆盖,默认 ask 为询问,也可指定为 true 或 false 来决定是否直接覆盖

stub : 模板文件,在 resources/stubs 目录下的文件,并以 “.stub” 为后缀

save-path : 生成文件保存路径,支持占位符,建议仅声明路径部分,包括资源名中可能包含的路径部分

save-file : 生成文件的文件名(包括后缀),支持占位符,建议仅声明文件名本身

class-prefix : 资源名作为类时,类名的前缀

class-postfix : 资源名作为类时,类名的后缀

namespace : 资源名作为类时,命名空间前缀

ask : 其他附加数据,通过询问方式获取值

ask 示例:

ask 所得数据可以在模板中以占位符替代

groups

对于不同的组合要求,可以定义不同的组,并在 命令中指定要适用的组配置,如使用 组的配置 :

示例配置:

每个组中必须有 选项,此定义了 命令所要生成的模块 并且每个模块都需要在后续进行声明配置 每个模块的配置与 中相关内容完全相同,如果该模块仅是对 中某模块的配置进行微调,则可以以 选项指定默认模块配置并对需要修改的选项进行配置

占位符

在前述内容中提到的占位符,在此集中说明

与资源名称有关的,以 Admin/UserAuth 为例, 模块配置以默认组的 controller 模块为例

配置中的占位符

save-path 和 save-file

时间相关:{Y} {y} {m} {d} {H} {i} {s},对应 函数中的格式

模板中的占位符

另外,还有前述 ask 配置的问题答案,可以用 来表示,如 ,

License

The MIT License (MIT). Please see License File for more information.


All versions of generator with dependencies

PHP Build Version
Package Version
Requires daijulong/console Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package daijulong/generator contains the following files

Loading the files please wait ....