clarkeash/factory

Factory helps you create php classes, interfaces and more.

1.0.0 2016-01-28 23:55 UTC

This package is auto-updated.

Last update: 2024-12-07 16:04:11 UTC


README

Factory helps you create php classes, interfaces and more

Author Travis Scrutinizer Codecov Packagist Version License

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.