$ wp mwp add-class <slug> <classname>
This command adds a correctly namespaced class to your plugin in the /classes
directory.
@Params
<slug>
(required) The slug (directory) of the plugin to add to
<classname>
(required) The name of the new class (namespaced relative to the plugin)
--type=<type>
(optional) The type of class to scaffold. (‘generic’, ‘model’, ‘singleton’, ‘controller’)
When specifying a class using the --type
parameter, the following values are allowed:
generic
: Generate a bare bones class. This is the default if no type is specified.model
: Generate a class which extends theActiveRecord
class to be used for a model.singleton
: Generate a class which extends theSingleton
class to be used for a singleton.controller
: Generate a generic controller class which extends theMWP\Framework\Pattern\Controller
class.model_controller
: Generate a controller that can be used for CRUD management ofActiveRecord
models.
@Example
$ wp mwp add-class acmecompany-gizmo Utility\Helper --type=singleton
Creating new plugin class file...
Class added successfully.