定制 jordimorillo/tdg-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jordimorillo/tdg-php

最新稳定版本:v1.0.0-beta.1

Composer 安装命令:

composer create-project jordimorillo/tdg-php

包简介

A Test Driven Generative Development tool to make the code parting from tests

README 文档

README

TDG-PHP is a tool for generating and testing PHP code based on provided tests. It utilizes a code generation service and runs tests to ensure the generated code meets the requirements specified in the tests.

Installation

To install TDG-PHP in your project, run the following command:

composer require jordimorillo/tdg-php

Usage

Once installed, you can use the tdg-php command to generate and test code based on a PHP test file. The command is executed as follows:

./vendor/bin/tdg-php path/to/test/file.php

Parameters

  • path/to/test/file.php: The path to the PHP test file that will be used to generate the code.

Example Usage

./vendor/bin/tdg-php tests/ExampleTest.php

Configuration

To ensure the tool works correctly, certain environment variables need to be configured. Below are the necessary variables and their purposes:

  • PROJECT_ROOT: The root path of the project.
  • PHPUNIT_XML_PATH: The path to the PHPUnit configuration file.
  • BASE_NAMESPACE: The base namespace of the project.
  • TESTS_BASE_NAMESPACE: The base namespace for the tests.
  • API_KEY: The API key for the code generation service.
  • MAX_ATTEMPTS: The maximum number of attempts to generate valid code.
  • PERMANENT_ATTACHMENTS: Additional files that will always be attached in the code generation process.

Example .env File

PROJECT_ROOT=/path/to/project
PHPUNIT_XML_PATH=/path/to/phpunit.xml
BASE_NAMESPACE=App
TESTS_BASE_NAMESPACE=Tests
API_KEY=your_api_key
MAX_ATTEMPTS=5
PERMANENT_ATTACHMENTS=src/Helper.php,src/Utils.php

Development

Requirements

  • PHP 8.0 or higher
  • Composer
  • PHP cURL extension

Running Tests

To run the tests, use the following command:

composer test

Contributing

Contributions are welcome. Please open an issue or submit a pull request to contribute to the project.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Additional Requirements

For the tool to work, it is necessary to install Llama3 locally.

👤 Autor

Jordi Morillo SellsLinkedIn

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固