clarkeash / factory
Factory helps you create php classes, interfaces and more.
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-12-07 16:04:11 UTC
README
Factory helps you create php classes, interfaces and more
Installation
composer global require clarkeash/factory
Usage
This package requires that you have psr-4 autoloading enabled in your composer.json file, as this is how it calculates the namespace for the classes you create.
The factory command should be ran from the root directory, where the composer.json lives.
Class
Create a basic class
factory make:class Application
Generates:
<?php namespace Acme; class Application { }
Create an abstract class
factory make:class Example --abstract
Generates:
<?php namespace Acme; abstract class Example { }
Interface
Create an interface
factory make:interface ExampleInterface
Generates:
<?php namespace Acme; interface ExampleInterface { }
Trait
Create a trait
factory make:trait ExampleTrait
Generates:
<?php namespace Acme; trait ExampleTrait { }
Test
Create a test
factory make:test Application
The above command will create a test class to test the Application class. And will generate the following:
<?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); } }
Testing
./vendor/bin/phpunit
##License
This package is released under the MIT license. Please see the License File for more information.