tom-millard/php-class-gen

Generate php classes


Keywords
class, helper, php-class-gen
License
BSD-3-Clause

Documentation

PHP class generator

Helper repo for creating php classes, with factory and unit test files.

Example:

php ./bin/classgen \\Namespace\\Class ./src --test=./tests

This will create the following:

  • Class.php in the src directory
  • ClassFactory.php in the src directory
  • ClassTest.php in the test directory

Creating the following structure:

  • src
    • Class.php
    • ClassFactory.php
  • tests
    • ClassTest.php

File structures are not taken from namespaces and nothing is assumed about the layout of the project.

Note: if no test dir is given no test will be created

Additional arguments

The following arguments can be passed in at the end of the required values.

argument description example
--extends=[string] extend the class --extends=\namespace\class
--no-factory Do not create a factory n/a