darling/php-darling-dev-tools

为Darling PHP库和项目开发提供开发工具。

v1.0.9 2024-02-10 02:41 UTC

This package is auto-updated.

Last update: 2024-09-10 03:50:53 UTC


README

   ___           ___           ___          ______          __
  / _ \___ _____/ (_)__  ___ _/ _ \___ _  _/_  __/__  ___  / /__
 / // / _ `/ __/ / / _ \/ _ `/ // / -_) |/ // / / _ \/ _ \/ (_-<
/____/\_,_/_/ /_/_/_//_/\_, /____/\__/|___//_/  \___/\___/_/___/
                       /___/

为Darling PHP库和项目开发提供开发工具。

此库提供了一个名为 NewClass.php 的脚本,可用于为Darling PHP库或项目开发设置新的类。

NewClass.php 脚本将生成新的Darling类所需的样板代码,包括其接口、TestTrait和测试类。

类、接口、TestTrait和测试类的源代码使用此库中 ./templates 目录中的模板生成。

安装

composer require darling/php-darling-dev-tools

用法

假设Darling Dev Tools库已安装,且当前目录是创建新类的项目根目录

php ./vendor/darling/php-darling-dev-tools/NewClass.php \
--path ./ \
--rootnamespace Darling\\ProjectName \
--name NewClassName \
--basetestname NameOfBaseTestClassForProject \
--subnamespace sub\\namespace

参数

--path
  The path to the project the class will be created for.
  For example: ./path/to/project

--rootnamespace
  The rootnamespace of the project.
  For example: Darling\\ProjectName

--name
  The name of the new class.
  For example: NewClassName \

--basetestname
  The name of the projects base PHPUnit test class.
  For example: ProjectNameTest \

--subnamespace
  The subnamespace to define for the class.
  This will follow the --rootnamespace.
  For example: classes\\utilities