Skip to content

Commit f4356ee

Browse files
committed
Upgrade to Codeigniter 4.2.1
1 parent 0dd882e commit f4356ee

17 files changed

Lines changed: 2378 additions & 155 deletions

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [atsanna] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
## [4.2.1] - 2022-06-17
5+
6+
- `The new StartScript allows you to update Codeigniter 4`: by reading the file */vendor/codeigniter4/framework/system/CodeIgniter.php*, the script checks if a composer update is required to update the application. **Warning: Always backup before using a new image!**
7+
- `Added the support for environment variables`: environment variables can be used to generate the Codeigniter .env file. The file will be generated at container startup only if REGEN_ENV_FILE = 1.
8+
- `New PHP images`: they are images designed for application development, complete with many pre-installed php and apache modules.
9+
- `The new images will have a new numbering`: the numbering will contain both the codeigniter version and the php version

Dockerfile

Lines changed: 332 additions & 38 deletions
Large diffs are not rendered by default.

Dockerfile-php7.4

Lines changed: 332 additions & 38 deletions
Large diffs are not rendered by default.

Dockerfile-php8.0

Lines changed: 332 additions & 38 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 300 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
11
## Docker Image for CodeIgniter4 development
22
[![Docker Build Status](https://img.shields.io/docker/cloud/build/atsanna/codeigniter4?style=for-the-badge)](https://hub.docker.com/r/atsanna/codeigniter4/)
3-
[![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/atsanna/codeigniter4/v4.2.0?style=for-the-badge)](https://hub.docker.com/r/atsanna/codeigniter4/)
4-
![Docker Pulls](https://img.shields.io/docker/pulls/atsanna/codeigniter4?style=for-the-badge)
3+
[![Docker Stars](https://img.shields.io/docker/stars/atsanna/codeigniter4?style=for-the-badge)](https://hub.docker.com/r/atsanna/codeigniter4/)
4+
[![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/atsanna/codeigniter4/latest?style=for-the-badge)](https://hub.docker.com/r/atsanna/codeigniter4/)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/atsanna/codeigniter4?style=for-the-badge)](https://hub.docker.com/r/atsanna/codeigniter4/)
6+
[![Docker Image Size](https://img.shields.io/docker/image-size/atsanna/codeigniter4?latest&style=for-the-badge)](https://hub.docker.com/r/atsanna/codeigniter4/)
57

68
This repository provides you a development environment without requiring you to install PHP, a web server, and any other server software on your local machine. For this, it requires Docker and Docker Compose.
79

810
Basic example to create your container (tested on Ubuntu 20.04 - Docker version 20.10.11, build dea9396 - docker-compose version 1.25.0 ):
911

1012
**NOTE: This package is under early development and is not ready for prime-time.**
1113

12-
## Build Image
13-
14-
create this structure:
15-
```
16-
codeigniter/
17-
- conf/apache.conf
18-
- Dockerfile
19-
- startScript.sh
20-
```
14+
**The old version is still available in the branch called "old"**
2115

22-
Go to the codeigniter folder:
23-
```
24-
cd codeigniter
25-
```
16+
## Build Image
2617

27-
build the image:<br>
18+
Clone thi repository and run:
2819
```
29-
docker build . -t codeigniter:4.2.0
20+
./build.sh
3021
```
3122

32-
start the container:
23+
start the container with php 7.4:
3324
```
34-
docker container run -it --publish 80:80 --name ci4 -v /localfolder:/var/www/html codeigniter:4.2.0
25+
docker container run -it --publish 80:80 --name ci4 -v /localfolder:/var/www/html codeigniter4.2.1:7.4.30-apache
3526
```
3627

37-
## Build image with PHP 7.4
28+
start the container with php 8.0:
3829
```
39-
docker build -f Dockerfile-php7.4 -t codeigniter:4.2.0 .
30+
docker container run -it --publish 80:80 --name ci4 -v /localfolder:/var/www/html codeigniter4.2.1:8.0.20-apache
4031
```
4132

42-
## Build image with PHP 8.0
33+
start the container with php 8.1:
4334
```
44-
docker build -f Dockerfile-php8.0 -t codeigniter:4.2.0 .
35+
docker container run -it --publish 80:80 --name ci4 -v /localfolder:/var/www/html codeigniter4.2.1:8.1.7-apache
4536
```
4637

4738
## Installation
@@ -64,12 +55,297 @@ docker-compose up -d
6455
docker-compose down --volumes
6556
```
6657

58+
# Environment variables summary:
59+
60+
## Environment file
61+
### allowed values are: [`0`, `1`]
62+
- `REGEN_ENV_FILE` - if 1, the `.env` file will be created and overwritten when the container starts
63+
64+
## App Configuration
65+
- `CI_ENVIRONMENT` - ENVIRONMENT [`production`, `develompent`, `tests`]
66+
- `APP_BASE_URL` - URL to your CodeIgniter root. Typically this will be your base URL, WITH a trailing slash [`http://localhots/`]
67+
- `APP_FORCE_GLOBAl_SECURE_REQUESTS` - If true, this will force every request made to this application to be made via a secure connection (HTTPS) [`true`, `false`]
68+
69+
70+
## App Session
71+
- `APP_SESSION_DRIVER` - [`CodeIgniter\Session\Handlers\FileHandler`]
72+
- `APP_SESSION_COOCKIE_NAME` - [`ci_session`]
73+
- `APP_SESSION_EXPIRATION` - [`7200`]
74+
- `APP_SESSION_SAVE_PATH` - [`null`]
75+
- `APP_SESSION_MATCH_CHIP` - [`true`, `false`]
76+
- `APP_SESSION_TIME_TO_UPDATE` - [`300`]
77+
- `APP_SESSION_REGENERATE_DESTROY` - [`true`, `false`]
78+
- `APP_CSP_ENABLED` - [`true`, `false`]
79+
80+
## Default Database Configuration
81+
- `DB_DEFAULT_HOSTNAME` - default hostname [`127.0.0.1`]
82+
- `DB_DEFAULT_DATABASE` - default database name
83+
- `DB_DEFAULT_USERNAME` - default database username
84+
- `DB_DEFAULT_PASSWORD` - default database password
85+
- `DB_DEFAULT_DRIVER` - default database driver [`MySQLi`, `SQLSRV`, `Postgre`, `OCI8`, `SQLite3`]
86+
- `DB_DEFAULT_PORT` - default database port [`3306`, `1443`, `5432`, `1521`]
87+
- `DB_DEFAULT_PREFIX` - default database prefix
88+
89+
## Tests Database Configuration
90+
- `DB_TESTS_HOSTNAME` - tests hostname [`127.0.0.1`]
91+
- `DB_TESTS_DATABASE` - tests database name
92+
- `DB_TESTS_USERNAME` - tests database username
93+
- `DB_TESTS_PASSWORD` - tests database password
94+
- `DB_TESTS_DRIVER` - tests database driver [`MySQLi`, `SQLSRV`, `Postgre`, `OCI8`, `SQLite3`]
95+
- `DB_TESTS_PORT` - tests database port [`3306`, `1443`, `5432`, `1521`]
96+
- `DB_TESTS_PREFIX` - tests database prefix
97+
98+
- `DB_DEFAULT_PREFIX` - default database prefix
99+
100+
## Content Secure Policy Configuration
101+
- `CONTENT_SECURE_POLICY_REPORT_ONLY` - Default CSP report context [`true`, `false`]
102+
- `CONTENT_SECURE_POLICY_DEFAULT_SRC` - Will default to self if not overridden [`none`]
103+
- `CONTENT_SECURE_POLICY_SCRIPT_SRC` - Lists allowed scripts' URLs [`self`]
104+
- `CONTENT_SECURE_POLICY_STYLE_SRC` - Lists allowed stylesheets' URLs [`self`]
105+
- `CONTENT_SECURE_POLICY_IMAGE_SRC` - Defines the origins from which images can be loaded [`self`]
106+
- `CONTENT_SECURE_POLICY_BASE_URI` - Restricts the URLs that can appear in a page's `<base>` element [`null`]
107+
- `CONTENT_SECURE_POLICY_CHILD_SRC` - Lists the URLs for workers and embedded frame contents [`null`]
108+
- `CONTENT_SECURE_POLICY_CONNECT_SRC` - Limits the origins that you can connect to (via XHR, WebSockets, and EventSource)[`self`]
109+
- `CONTENT_SECURE_POLICY_FONT_SRC` - Specifies the origins that can serve web fonts [`null`]
110+
- `CONTENT_SECURE_POLICY_FORM_ACTION` - Lists valid endpoints for submission from `<form>` tags [`null`]
111+
- `CONTENT_SECURE_POLICY_FRAME_ANCESTORS` - Specifies the sources that can embed the current page [`null`]
112+
- `CONTENT_SECURE_POLICY_RFAME_SRC` - The frame-src directive restricts the URLs which may be loaded into nested browsing contexts [`null`]
113+
- `CONTENT_SECURE_POLICY_MEDIA_SRC` - Restricts the origins allowed to deliver video and audio [`null`]
114+
- `CONTENT_SECURE_POLICY_OBJECT_SRC` - Allows control over Flash and other plugins [`null`]
115+
- `CONTENT_SECURE_POLICY_PLUGIN_TYPES` - Limits the kinds of plugins a page may invoke [`null`]
116+
- `CONTENT_SECURE_POLICY_REPORT_URI` - Specifies a URL where a browser will send reports when a content security policy is violated [`null`]
117+
- `CONTENT_SECURE_POLICY_SANDBOX` - List of actions allowed [`true`, `false`]
118+
- `CONTENT_SECURE_POLICY_UPGRADE_INSECURE_REQUESTS` - Instructs user agents to rewrite URL schemes, changing HTTP to HTTPS. This directive is for websites with large numbers of old URLs that need to be rewritten[`true`, `false`]
119+
120+
## Cookie Configuration
121+
- `COOKIE_PREFIX` - Set a cookie name prefix if you need to avoid collisions [``]
122+
- `COOKIE_EXPIRES` - Default expires timestamp for cookies [`0`]
123+
- `COOKIE_PATH` - Typically will be a forward slash [`/`]
124+
- `COOKIE_DOMAIN` - Set to `.your-domain.com` for site-wide cookies [``]
125+
- `COOKIE_SECURE` - Cookie will only be set if a secure HTTPS connection exists [`true`, `false`]
126+
- `COOKIE_HTTP_OLNY` - Cookie will only be accessible via HTTP(S) (no JavaScript) [`true`, `false`]
127+
- `COOKIE_SAME_SITE` - Configure cookie SameSite setting [`None`, `Lax`, `Strict`, `''`]
128+
- `COOKIE_RAW` - This flag allows setting a "raw" cookie [`true`, `false`]
129+
130+
## Encryption Configuration
131+
- `ENCRYPTION_KEY` - If you use the Encryption class you must set an encryption key (seed) [``]
132+
- `ENCRYPTION_DRIVER` - One of the supported encryption drivers [`OpenSSL`, `Sodium`]
133+
- `ENCRYPTION_BLOCK_SIZE` - This is the number of bytes that will be padded to the plaintext message before it is encrypted [`16`]
134+
- `ENCRYPTION_DIGEST` - HMAC digest to use [`SHA256`, `SHA512`]
135+
136+
## Honeypot Configuration
137+
- `HONEYPOT_HIDDEN` - Makes Honeypot visible or not to human [`true`, `false`]
138+
- `HONEYPOT_LABEL` - Honeypot Label Content [`Fill This Field`]
139+
- `HONEYPOT_NAME` - Honeypot Field Name [`honeypot`]
140+
- `HONEYPOT_TEMPLATE` - Honeypot HTML Template [`<label>{label}</label><input type="text" name="{name}" value=""/>`]
141+
- `HONEYPOT_CONTAINER` - Honeypot container [`<div style="display:none">{template}</div>`]
142+
143+
## Security Configuration
144+
- `SECURITY_CSRF_PROTECTION` - Protection Method for Cross Site Request Forgery protection [`cookie`, `session`]
145+
- `SECURITY_TOKEN_RANDOMIZE` - Randomize the CSRF Token for added security [`true`, `false`]
146+
- `SECURITY_TOKEN_NAME` - Token name for Cross Site Request Forgery protection [`csrf_token_name`]
147+
- `SECURITY_HEADER_NAME` - Header name for Cross Site Request Forgery protection [`X-CSRF-TOKE`]
148+
- `SECURITY_COOKIE_NAME` - Cookie name for Cross Site Request Forgery protection [`csrf_cookie_name`]
149+
- `SECURITY_EXPIRES` - Expiration time for Cross Site Request Forgery protection cookie [`7200`]
150+
- `SECURITY_REGENERATE` - Regenerate CSRF Token on every submission [`true`, `false`]
151+
- `SECURITY_REDIRECT` - Redirect to previous page with error on failure [`true`, `false`]
152+
- `SECURITY_SAME_SITE` - Setting for CSRF SameSite cookie token [`None`, `Lax`, `Strict`, `''`]
153+
154+
## Logger Configuration
155+
- `LOGGER_THRESHOLD` - You can enable error logging by setting a threshold over zero [`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`]
156+
- Threshold options are:
157+
* 0 = Disables logging, Error logging TURNED OFF
158+
* 1 = Emergency Messages - System is unusable
159+
* 2 = Alert Messages - Action Must Be Taken Immediately
160+
* 3 = Critical Messages - Application component unavailable, unexpected exception.
161+
* 4 = Runtime Errors - Don't need immediate action, but should be monitored.
162+
* 5 = Warnings - Exceptional occurrences that are not errors.
163+
* 6 = Notices - Normal but significant events.
164+
* 7 = Info - Interesting events, like user logging in, etc.
165+
* 8 = Debug - Detailed debug information.
166+
* 9 = All Messages
167+
168+
## Curl Request Configuration
169+
- `CURL_REQUEST_SHARE_OPTIONS` - Whether share options between requests or not [`true`, `false`]
170+
171+
## Sendmail Configuration
172+
- `ROOT_EMAIL` - The user that gets all mail for userids less than 1000. Ifblank, address rewriting is disabled.
173+
- `MAIL_SERVER` - The host to send mail to, in the form host.
174+
- `MAIL_SERVER_PORT` - The port to send mail to, in the form host.
175+
- `MAIL_SERVER_USER` - The user name to use for SMTP AUTH.
176+
- `MAIL_SERVER_PASSWORD` - The password to use for SMTP AUTH.
177+
- `MAIL_SERVER_TLS` - Specifies whether ssmtp uses TLS to talk to the SMTP server.
178+
- `MAIL_SERVER_STARTTLS` - Specifies whether ssmtp does a EHLO/STARTTLS before starting SSL negotiation.
179+
180+
## List of Apache Modules pre-installed on these Docker images (apachectl -M)
181+
182+
- `core_module` (static)
183+
- `so_module` (static)
184+
- `watchdog_module` (static)
185+
- `http_module` (static)
186+
- `log_config_module` (static)
187+
- `logio_module` (static)
188+
- `version_module` (static)
189+
- `unixd_module` (static)
190+
- `access_compat_module` (shared)
191+
- `alias_module` (shared)
192+
- `auth_basic_module` (shared)
193+
- `authn_core_module` (shared)
194+
- `authn_file_module` (shared)
195+
- `authz_core_module` (shared)
196+
- `authz_host_module` (shared)
197+
- `authz_user_module` (shared)
198+
- `autoindex_module` (shared)
199+
- `cgi_module` (shared)
200+
- `deflate_module` (shared)
201+
- `dir_module` (shared)
202+
- `env_module` (shared)
203+
- `expires_module` (shared)
204+
- `fcgid_module` (shared)
205+
- `filter_module` (shared)
206+
- `headers_module` (shared)
207+
- `mime_module` (shared)
208+
- `mpm_prefork_module` (shared)
209+
- `negotiation_module` (shared)
210+
- `php_module` (shared)
211+
- `proxy_module` (shared)
212+
- `proxy_http_module` (shared)
213+
- `reqtimeout_module` (shared)
214+
- `rwrite_module` (shared)
215+
- `setenvif_module` (shared)
216+
- `socache_shmcb_module` (shared)
217+
- `ssl_module` (shared)
218+
- `status_module` (shared)
219+
220+
221+
## List of PHP Modules pre-installed on these Docker images (php -m)
222+
223+
[PHP Modules]
224+
- `amqp`
225+
- `ast`
226+
- `bcmath`
227+
- `bz2`
228+
- `calendar`
229+
- `Core`
230+
- `csv`
231+
- `ctype`
232+
- `curl`
233+
- `date`
234+
- `dba`
235+
- `decimal`
236+
- `dom`
237+
- `ds`
238+
- `enchant`
239+
- `ev`
240+
- `event`
241+
- `excimer`
242+
- `exif`
243+
- `FFI`
244+
- `fileinfo`
245+
- `filter`
246+
- `ftp`
247+
- `gd`
248+
- `geospatial`
249+
- `gettext`
250+
- `gmp`
251+
- `gnupg`
252+
- `grpc`
253+
- `hash`
254+
- `http`
255+
- `iconv`
256+
- `igbinary`
257+
- `imagick`
258+
- `imap`
259+
- `inotify`
260+
- `intl`
261+
- `json`
262+
- `json_post`
263+
- `ldap`
264+
- `libsmbclient`
265+
- `libxml`
266+
- `lzf`
267+
- `mailparse`
268+
- `maxminddb`
269+
- `mbstring`
270+
- `mcrypt`
271+
- `memcache`
272+
- `memcached`
273+
- `mongodb`
274+
- `msgpack`
275+
- `mysqli`
276+
- `mysqlnd`
277+
- `OAuth`
278+
- `oci8`
279+
- `odbc`
280+
- `opencensus`
281+
- `openssl`
282+
- `openswoole`
283+
- `pcntl`
284+
- `pcov`
285+
- `pcre`
286+
- `PDO`
287+
- `pdo_dblib`
288+
- `PDO_Firebird`
289+
- `pdo_mysql`
290+
- `PDO_OCI`
291+
- `PDO_ODBC`
292+
- `pdo_pgsql`
293+
- `pdo_sqlite`
294+
- `pdo_sqlsrv`
295+
- `pgsql`
296+
- `Phar`
297+
- `posix`
298+
- `pspell`
299+
- `raphf`
300+
- `readline`
301+
- `redis`
302+
- `Reflection`
303+
- `SeasLog`
304+
- `session`
305+
- `shmop`
306+
- `SimpleXML`
307+
- `smbclient`
308+
- `snmp`
309+
- `soap`
310+
- `sockets`
311+
- `sodium`
312+
- `SPL`
313+
- `sqlite3`
314+
- `sqlsrv`
315+
- `ssh2`
316+
- `standard`
317+
- `tokenizer`
318+
- `uuid`
319+
- `xdebug`
320+
- `xml`
321+
- `xmldiff`
322+
- `xmlreader`
323+
- `xmlrpc`
324+
- `xmlwriter`
325+
- `xsl`
326+
- `yac`
327+
- `yaml`
328+
- `yar`
329+
- `Zend OPcache`
330+
- `zend_test`
331+
- `zephir_parser`
332+
- `zip`
333+
- `zlib`
334+
- `zstd`
335+
336+
[Zend Modules]
337+
- `Xdebug`
338+
- `Zend OPcache`
339+
340+
## Changelog
341+
342+
You can find the changes made in the [changelog](CHANGELOG) file
343+
67344
## Contributing
68345

69346
Contributions are welcome!
70347
Leave an issue on Github, or create a Pull Request.
71348

72-
73349
## Licence
74350

75351
This work is under [MIT](LICENSE) licence.

0 commit comments

Comments
 (0)