Create a controller

Create a new project using one of the following scripts

  • ./vendor/bin/vespula-cli-create
  • ./vendor/bin/vespula-cli-controller

Note

When you are finished creating your controller, you will need to add routes to the routes.php file to match routes to class methods.

vespula-cli-create

This is an interactive script that lets you choose between a project and a controller. There are three things you need to know when running this script.

What is path to the project folder?
This is the path, relative to the current folder or absolute, to the project. For example: src/MyProject

What is the name of the new controller?
Provide the name of the new controller in CamelCase. For example, MyController.

What class do you want to extend?
Provide the name of the base controller you want to extend. By default, this is Controller

vespula-cli-controller

This script is less interactive and lets you create a controller for a given project. Here is an example:

1
$ ./vendor/bin/vespula-cli-controller -t src/MyProject -n Posts -e MyController

-t is the target path to the project, including the project folder name
-n is the name of the controller
-e is the name of the controller you wish to extend.

You can get help with ./vendor/bin/vespula-cli-controller -h