clarkeash / factory
Factory 帮助您创建 PHP 类、接口等。
1.0.0
2016-01-28 23:55 UTC
Requires
- illuminate/container: ^5.2
- illuminate/support: ^5.2
- league/flysystem: ^1.0
- mustache/mustache: ^2.9
- roave/better-reflection: ^0.1.0
- symfony/console: ~2.7|~3.0
- symfony/process: ~2.7|~3.0
Requires (Dev)
- clarkeash/flysystem-vfs-stream: dev-master
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: ^5.1
This package is auto-updated.
Last update: 2024-09-07 15:33:18 UTC
README
Factory 帮助您创建 PHP 类、接口等
安装
composer global require clarkeash/factory
使用
此包要求您在 composer.json 文件中启用 psr-4 自动加载,因为这是它计算您创建的类的命名空间的方式。
应从包含 composer.json 文件的根目录运行 factory 命令。
类
创建基本类
factory make:class Application
生成
<?php namespace Acme; class Application { }
创建抽象类
factory make:class Example --abstract
生成
<?php namespace Acme; abstract class Example { }
接口
创建接口
factory make:interface ExampleInterface
生成
<?php namespace Acme; interface ExampleInterface { }
特质
创建特质
factory make:trait ExampleTrait
生成
<?php namespace Acme; trait ExampleTrait { }
测试
创建测试
factory make:test Application
上述命令将创建一个测试类来测试 Application 类。并将生成以下
<?php use Acme\Application; class ApplicationTest extends \PHPUnit_Framework_TestCase { /** * @var Application */ protected $unit; public function setUp() { $this->unit = new Application(); } /** * @test */ public function it_works() { $this->assertTrue(true); } }
测试
./vendor/bin/phpunit
##许可证
此包根据 MIT 许可证发布。有关更多信息,请参阅许可证文件。