]> git.mxchange.org Git - friendica.git/blob - src/Module/README.md
Merge pull request #7848 from annando/mail-hooks
[friendica.git] / src / Module / README.md
1 ## Friendica\Module
2
3 The Module namespace contains the different modules of Friendica.
4 Each module is loaded through the [`App`](https://github.com/friendica/friendica/blob/develop/src/App.php).
5
6 There are mainly two types of modules:
7 -       frontend modules to interact with users
8 -       backend modules to interact with machine requests
9
10 ### Frontend modules
11
12 This type of modules mainly needs a template, which are generally located at
13 [view/templates/](https://github.com/friendica/friendica/tree/develop/view/templates).
14
15 A frontend module should extend the [`BaseModule`](https://github.com/friendica/friendica/blob/develop/src/BaseModule.php), especially the `content()` method. 
16
17 ### Backend modules
18
19 This type of modules mainly responds either with encoded `XML` or with `JSON` output.
20 It isn't intended to respond with human readable text.
21
22 A frontend module should extend the [`BaseModule`](https://github.com/friendica/friendica/blob/develop/src/BaseModule.php), especially the `rawContent()` method.
23  
24 ### Routing
25
26 Every module needs to be accessed within a route.
27 The routes are defined inside [`Router->collectRoutes()`](https://github.com/friendica/friendica/blob/develop/src/App/Router.php).
28
29 Use the given routes as a pattern for further routes.
30
31 The routing library and further documentation can be found [here](https://github.com/nikic/FastRoute).