Skip to content

Commit e7fe68e

Browse files
committed
docs: update sample code
1 parent 5ecf70d commit e7fe68e

4 files changed

Lines changed: 29 additions & 8 deletions

File tree

user_guide_src/source/concepts/autoloader.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ You may change this namespace by editing the **app/Config/Constants.php** file a
6767
new namespace value under the ``APP_NAMESPACE`` setting:
6868

6969
.. literalinclude:: autoloader/002.php
70+
:lines: 2-
7071

7172
You will need to modify any existing files that are referencing the current namespace.
7273

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<?php
22

3-
$psr4 = [
4-
'App' => APPPATH,
5-
'CodeIgniter' => SYSTEMPATH,
6-
];
3+
namespace Config;
4+
5+
use CodeIgniter\Config\AutoloadConfig;
6+
7+
class Autoload extends AutoloadConfig
8+
{
9+
// ...
10+
public $psr4 = [
11+
APP_NAMESPACE => APPPATH, // For custom app namespace
12+
'Config' => APPPATH . 'Config',
13+
];
14+
15+
// ...
16+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php
22

3-
define('APP_NAMESPACE', 'App');
3+
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<?php
22

3-
$classmap = [
4-
'Markdown' => APPPATH . 'third_party/markdown.php',
5-
];
3+
namespace Config;
4+
5+
use CodeIgniter\Config\AutoloadConfig;
6+
7+
class Autoload extends AutoloadConfig
8+
{
9+
// ...
10+
public $classmap = [
11+
'Markdown' => APPPATH . 'third_party/markdown.php',
12+
];
13+
14+
// ...
15+
}

0 commit comments

Comments
 (0)