1. Home
  2. Docs
  3. Application Framework
  4. CLI Reference
  5. add-class

add-class

$ 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: This generates a bare bones utility class. This is the default if no type is specified.
  • model: This generates a new class which extends the ActiveRecord class to be used for a model.
  • singleton: This generates a new class which extends the Singleton class to be used for a singleton.
  • controller: This generates a new controller class which extends the MWP\Framework\Pattern\Controller class.

@Example

$ wp mwp add-class acmecompany-gizmo Utility\Helper
Creating new plugin class file...
Class added successfully.

Was this article helpful to you? Yes No

How can we help?