Skip to content

Commit

Permalink
add Introduction.md
Browse files Browse the repository at this point in the history
  • Loading branch information
easy-system committed Jun 13, 2016
1 parent 2d0910d commit 68f4110
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions docs/Introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Introduction
============

# Configuration

The module can provide configuration of system controllers. By convention,
this configuration should be located in a separate file `controllers.config.php`
in the configuration directory of module. This file must be included with the
system configuration file:
```
project/
module/
ExampleModule/
Module.php
config/
system.config.php
controllers.config.php
src/
...
```

The file `project/module/ExampleModule/config/system.config.php`:
```
return [
'controllers' => require __DIR__ . DIRECTORY_SEPARATOR . 'controllers.config.php',
];
```

The file `project/module/ExampleModule/config/controllers.config.php`:
```
return [
'ExampleModule.Controller.Index' => 'ExampleModule\Controller\IndexController',
'ExampleModule.Controller.Bar' => 'ExampleModule\Controller\BarController',
// ...
];
```

# Convention

This should not be mandatory, to class of controller must be inherit any class.

The files with controller classes should be located in the `Controller` directory.
For directories is allowed any level of nesting:

- `ExampleModule/src/Controller/IndexController`
- `ExampleModule/src/Controller/Frontend/IndexController`
- `ExampleModule/src/Frontend/Controller/IndexController`

The controller classes must be ended with the `Controller` postfix:

- `IndexController`
- `FooController`
- `BarController`

The name of the controller action must be ended with the `Action` postfix:

- `indexAction`
- `fooAction`
- `barAction`

The action may accept as arguments:
- As first argument - an instance of the `Psr\Http\Message\ServerRequestInterface`
- As second argument - an instance of the `Psr\Http\Message\ResponseInterface`

0 comments on commit 68f4110

Please sign in to comment.