staempfli/universal-code-generator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

staempfli/universal-code-generator

最新稳定版本:1.2.4

Composer 安装命令:

composer require staempfli/universal-code-generator

包简介

Staempfli AG - Universal Code Generator Tool

README 文档

README

Project Status: Abandoned – Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development.

This tool can be used as base for creating code generators for specific frameworks

Usage

  1. Create your own generator project:

  2. Add this project as dependency

    composer require "staempfli/universal-code-generator":"~1.0"
    composer update
    
  3. Copy needed default configuration file

    • $ cp vendor/staempfli/universal-code-generator/config/default-properties.yml.dist config/default-properties.yml
  4. You need to create a PHP script to define the console application:

    • We recommend to do that into the bin folder

      cd bin && vim <command_name>

    • Add the following content to this file:

    #!/usr/bin/env php
    <?php
    $composerAutoload = __DIR__ . '/../../../autoload.php';
    
    if (file_exists($composerAutoload)) {
        require_once $composerAutoload;
    } else {
        require_once __DIR__ . ' /../vendor/autoload.php';
    }
    
    /**
    * Shortcut constant for the project root directory
    */
    define('BP', dirname(__DIR__));
    /**
    * Command name
    */
    define('COMMAND_NAME', basename(__FILE__));
    
    // Init Console Application
    use Staempfli\UniversalGenerator\Application;
    
    $application = new Application('@git-version@');
    
    /**
    * You can add new commands or extend exiting ones to add custom functionality
    * - Check default commands in Staempfli\UniversalGenerator\Application
    * - To add or extend commands you must use the method $application->addGeneratorCommand
    */
    // $application->addGeneratorCommand('template:generate', 'VendorName\ProjectName\Command\TemplateGenerateCommand');
    
    $application->run();
    
  5. Usually you might want to extend the default template:generate command. You can do that as follows:

  6. Create the templates that will be generated:

Prerequisites

  • PHP >= 5.6.*

Developers

Licence

GNU General Public License, version 3 (GPLv3)

Copyright

(c) 2016 Staempfli AG

统计信息

  • 总下载量: 3.64k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 4
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2016-10-13