This creator is used to generate some PHP Classes in an organized structure. It use an autoloader, so you can easily call the classes you want between them and from a php main script by calling the autoloader. It also let you create PHPUnit test classes to test your php classes.
To use this Creator you need to have read and write rights to create files by PHP.
Install it with composer
To install composer :
$ curl -sS https://getcomposer.org/installer | php
To install the latest version of the creator :
$ php composer.phar create-project gnkw/creator gnkw-creator
$ php composer.phar create-project gnkw/creator gnkw-creator master
Go to your creator
$ cd gnkw-creator
Update from 1.x to 2.x
This is the version 2.x of the creator, so now, you can't transform your classes and you can't use the old notation class like this : MyClass.class.php.
Please transform your classes with the standard notation : MyClass.php before updating the creator.
Create a class
You can create a class by using this command (replace Name/Space and MyClass by your datas) :
$ php app/console.php create class Name/Space MyClass
Create a test class
To create a test class for a class using PHPUnit, it's a similar syntax :
$ php app/console.php create test Name/Space MyClass
Note : If the original class don't exist, the test class can't be created.
Use a class
index.php example file to your web directory
$ mkdir web && cp examples/index.php web/.
After that, you want use your classes, so go to the
web/index.php file and use or precise the namespace in the Your Main Code section :
$ vim web/index.php
/** * Your Main Code */ use \Name\Space\MyClass; $myClass = new MyClass();
Then, when executing
web/index.php, it returns :
$ php web/index.php Hello MyClass !