Skip to content

Commit 621323b

Browse files
committed
docs: add sample code for Acme\Blog namespace definition
1 parent 4995720 commit 621323b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

user_guide_src/source/general/modules.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,17 @@ This is configured in the file **app/Config/Modules.php**.
101101
The auto-discovery system works by scanning for particular directories and files within psr4 namespaces that have been defined in **Config/Autoload.php**.
102102

103103
To make auto-discovery work for our **Blog** namespace, we need to make one small adjustment.
104-
**Acme** needs to be changed to **Acme\\Blog** because each "module" within the namespace needs to be fully defined. Once your module folder path is defined, the discovery process would look for discoverable items on that path and should, for example, find the routes file at **/acme/Blog/Config/Routes.php**.
104+
**Acme** needs to be changed to **Acme\\Blog** because each "module" within the namespace needs to be fully defined.
105+
106+
::
107+
108+
public $psr4 = [
109+
APP_NAMESPACE => APPPATH, // For custom namespace
110+
'Config' => APPPATH . 'Config',
111+
'Acme\Blog' => ROOTPATH . 'acme/Blog', // Change
112+
];
113+
114+
Once your module folder path is defined, the discovery process would look for discoverable items on that path and should, for example, find the routes file at **/acme/Blog/Config/Routes.php**.
105115

106116
Enable/Disable Discover
107117
=======================

0 commit comments

Comments
 (0)