summaryrefslogtreecommitdiff
path: root/doc/plugin-registration.markdown
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-29 20:33:48 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-29 20:33:48 -0400
commitfb642b76bb3d84b38c09f5d9dff8b51369eedaf2 (patch)
tree29331a2df63d259811e8dc70065ef8507998c1fe /doc/plugin-registration.markdown
parentb69eb5f99350a378387ab1f711d4fbe3bb3bddab (diff)
Make console commands pluggable
Diffstat (limited to 'doc/plugin-registration.markdown')
-rw-r--r--doc/plugin-registration.markdown41
1 files changed, 36 insertions, 5 deletions
diff --git a/doc/plugin-registration.markdown b/doc/plugin-registration.markdown
index 4b6e85c0..37540f29 100644
--- a/doc/plugin-registration.markdown
+++ b/doc/plugin-registration.markdown
@@ -110,8 +110,8 @@ public function getClasses()
{
return array(
'Plugin\Budget\Model' => array(
- 'HourlyRate',
- 'Budget',
+ 'HourlyRateModel',
+ 'BudgetModel',
)
);
}
@@ -120,11 +120,42 @@ public function getClasses()
Now, if you use a class that extends from `Core\Base`, you can access directly to those class instance:
```php
-$this->hourlyRate->remove(123);
-$this->budget->getDailyBudgetBreakdown(456);
+$this->hourlyRateModel->remove(123);
+$this->budgetModel->getDailyBudgetBreakdown(456);
// It's the same thing as using the container:
-$this->container['hourlyRate']->getAll();
+$this->container['hourlyRateModel']->getAll();
```
Keys of the containers are unique across the application. If you override an existing class, you will change the default behavior.
+
+Add new API methods
+-------------------
+
+Kanboard use this library [JSON-RPC](https://github.com/fguillot/JsonRPC) to handle API calls.
+
+To add a new method you can do something like that from your plugin:
+
+```php
+$this->api->getProcedureHandler()->withCallback('my_method', function() {
+ return 'foobar';
+});
+```
+
+`$this->container['api']` or `$this->api` expose an instance of the object `JsonRPC\Server`.
+
+Read the library documentation for more information.
+
+Add new console commands
+------------------------
+
+Kanboard use the library [Symfony Console](http://symfony.com/doc/current/components/console/introduction.html) to handle local command lines.
+
+Kanboard expose an instance of the object `Symfony\Component\Console\Application` via `$this->cli`.
+You can add new commands from your plugin:
+
+```php
+$this->cli->add(new MyCommand());
+```
+
+Read the library documentation for more information.