16 |
17 |
= lang('Errors.whoops') ?>
18 |
19 |
= lang('Errors.weHitASnag') ?>
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/builds:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | 'vcs',
56 | 'url' => GITHUB_URL,
57 | ];
58 | }
59 |
60 | $array['require']['codeigniter4/codeigniter4'] = 'dev-develop';
61 | unset($array['require']['codeigniter4/framework']);
62 | } else {
63 | unset($array['minimum-stability']);
64 |
65 | if (isset($array['repositories'])) {
66 | foreach ($array['repositories'] as $i => $repository) {
67 | if ($repository['url'] === GITHUB_URL) {
68 | unset($array['repositories'][$i]);
69 | break;
70 | }
71 | }
72 |
73 | if (empty($array['repositories'])) {
74 | unset($array['repositories']);
75 | }
76 | }
77 |
78 | $array['require']['codeigniter4/framework'] = LATEST_RELEASE;
79 | unset($array['require']['codeigniter4/codeigniter4']);
80 | }
81 |
82 | file_put_contents($file, json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL);
83 |
84 | $modified[] = $file;
85 | } else {
86 | echo 'Warning: Unable to decode composer.json! Skipping...' . PHP_EOL;
87 | }
88 | } else {
89 | echo 'Warning: Unable to read composer.json! Skipping...' . PHP_EOL;
90 | }
91 | }
92 |
93 | $files = [
94 | __DIR__ . DIRECTORY_SEPARATOR . 'app/Config/Paths.php',
95 | __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist',
96 | __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml',
97 | ];
98 |
99 | foreach ($files as $file) {
100 | if (is_file($file)) {
101 | $contents = file_get_contents($file);
102 |
103 | if ($dev) {
104 | $contents = str_replace('vendor/codeigniter4/framework', 'vendor/codeigniter4/codeigniter4', $contents);
105 | } else {
106 | $contents = str_replace('vendor/codeigniter4/codeigniter4', 'vendor/codeigniter4/framework', $contents);
107 | }
108 |
109 | file_put_contents($file, $contents);
110 |
111 | $modified[] = $file;
112 | }
113 | }
114 |
115 | if ($modified === []) {
116 | echo 'No files modified.' . PHP_EOL;
117 | } else {
118 | echo 'The following files were modified:' . PHP_EOL;
119 |
120 | foreach ($modified as $file) {
121 | echo " * {$file}" . PHP_EOL;
122 | }
123 |
124 | echo 'Run `composer update` to sync changes with your vendor folder.' . PHP_EOL;
125 | }
126 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "codeigniter4/appstarter",
3 | "description": "CodeIgniter4 starter app",
4 | "license": "MIT",
5 | "type": "project",
6 | "homepage": "https://codeigniter.com",
7 | "support": {
8 | "forum": "https://forum.codeigniter.com/",
9 | "source": "https://github.com/codeigniter4/CodeIgniter4",
10 | "slack": "https://codeigniterchat.slack.com"
11 | },
12 | "require": {
13 | "php": "^8.1",
14 | "codeigniter4/framework": "^4.0"
15 | },
16 | "require-dev": {
17 | "fakerphp/faker": "^1.9",
18 | "mikey179/vfsstream": "^1.6",
19 | "phpunit/phpunit": "^10.5.16"
20 | },
21 | "autoload": {
22 | "psr-4": {
23 | "App\\": "app/",
24 | "Config\\": "app/Config/"
25 | },
26 | "exclude-from-classmap": [
27 | "**/Database/Migrations/**"
28 | ]
29 | },
30 | "autoload-dev": {
31 | "psr-4": {
32 | "Tests\\Support\\": "tests/_support"
33 | }
34 | },
35 | "config": {
36 | "optimize-autoloader": true,
37 | "preferred-install": "dist",
38 | "sort-packages": true
39 | },
40 | "scripts": {
41 | "test": "phpunit"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/env:
--------------------------------------------------------------------------------
1 | #--------------------------------------------------------------------
2 | # Example Environment Configuration file
3 | #
4 | # This file can be used as a starting point for your own
5 | # custom .env files, and contains most of the possible settings
6 | # available in a default install.
7 | #
8 | # By default, all of the settings are commented out. If you want
9 | # to override the setting, you must un-comment it by removing the '#'
10 | # at the beginning of the line.
11 | #--------------------------------------------------------------------
12 |
13 | #--------------------------------------------------------------------
14 | # ENVIRONMENT
15 | #--------------------------------------------------------------------
16 |
17 | # CI_ENVIRONMENT = production
18 |
19 | #--------------------------------------------------------------------
20 | # APP
21 | #--------------------------------------------------------------------
22 |
23 | # app.baseURL = ''
24 | # If you have trouble with `.`, you could also use `_`.
25 | # app_baseURL = ''
26 | # app.forceGlobalSecureRequests = false
27 | # app.CSPEnabled = false
28 |
29 | #--------------------------------------------------------------------
30 | # DATABASE
31 | #--------------------------------------------------------------------
32 |
33 | # database.default.hostname = localhost
34 | # database.default.database = ci4
35 | # database.default.username = root
36 | # database.default.password = root
37 | # database.default.DBDriver = MySQLi
38 | # database.default.DBPrefix =
39 | # database.default.port = 3306
40 |
41 | # If you use MySQLi as tests, first update the values of Config\Database::$tests.
42 | # database.tests.hostname = localhost
43 | # database.tests.database = ci4_test
44 | # database.tests.username = root
45 | # database.tests.password = root
46 | # database.tests.DBDriver = MySQLi
47 | # database.tests.DBPrefix =
48 | # database.tests.charset = utf8mb4
49 | # database.tests.DBCollat = utf8mb4_general_ci
50 | # database.tests.port = 3306
51 |
52 | #--------------------------------------------------------------------
53 | # ENCRYPTION
54 | #--------------------------------------------------------------------
55 |
56 | # encryption.key =
57 |
58 | #--------------------------------------------------------------------
59 | # SESSION
60 | #--------------------------------------------------------------------
61 |
62 | # session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
63 | # session.savePath = null
64 |
65 | #--------------------------------------------------------------------
66 | # LOGGER
67 | #--------------------------------------------------------------------
68 |
69 | # logger.threshold = 4
70 |
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/session/ExampleSessionTest.php:
--------------------------------------------------------------------------------
1 | set('logged_in', 123);
15 | $this->assertSame(123, $session->get('logged_in'));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/unit/HealthTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(defined('APPPATH'));
15 | }
16 |
17 | public function testBaseUrlHasBeenSet(): void
18 | {
19 | $validation = service('validation');
20 |
21 | $env = false;
22 |
23 | // Check the baseURL in .env
24 | if (is_file(HOMEPATH . '.env')) {
25 | $env = preg_grep('/^app\.baseURL = ./', file(HOMEPATH . '.env')) !== false;
26 | }
27 |
28 | if ($env) {
29 | // BaseURL in .env is a valid URL?
30 | // phpunit.xml.dist sets app.baseURL in $_SERVER
31 | // So if you set app.baseURL in .env, it takes precedence
32 | $config = new App();
33 | $this->assertTrue(
34 | $validation->check($config->baseURL, 'valid_url'),
35 | 'baseURL "' . $config->baseURL . '" in .env is not valid URL',
36 | );
37 | }
38 |
39 | // Get the baseURL in app/Config/App.php
40 | // You can't use Config\App, because phpunit.xml.dist sets app.baseURL
41 | $reader = new ConfigReader();
42 |
43 | // BaseURL in app/Config/App.php is a valid URL?
44 | $this->assertTrue(
45 | $validation->check($reader->baseURL, 'valid_url'),
46 | 'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL',
47 | );
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/writable/.htaccess:
--------------------------------------------------------------------------------
1 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/logs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/session/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/writable/uploads/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------