承接 mileschou/codegener 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mileschou/codegener

最新稳定版本:v2.2.0

Composer 安装命令:

composer require mileschou/codegener

包简介

The helper for generate code.

README 文档

README

tests codecov Codacy Badge Latest Stable Version Total Downloads License Beerpay

The helper for generate code.

Concept

Sometimes, we need to generate many code, like Scaffold, compiled code, even document.

This package can help to write code easily.

Usage

Writer class need Laravel Filesystem, it's testable, and need instance implemented PSR-3 Logger interface.

public function __construct(Filesystem $filesystem, LoggerInterface $logger)

Use write() method to put code instantly. Codegener will overwrite when $overwrite is true.

public function write(string $path, $content, bool $overwrite = false): void

Use writeMass if need generate many code.

public function writeMass(iterable $contents, bool $overwrite = false): void

Traits

Following traits is helper for process env and path.

Example

Following is an example code.

$writer->setBasePath('/path/to/your/project');

$code = [
    'some-foo' => 'foo',
    'some-bar' => 'bar',
];

$writer->writeMass($code);

Codegener will generate two files.

$ cat /path/to/your/project/some-foo
foo
$ cat /path/to/your/project/some-bar
bar

Example Projects

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-19