From 7bba70b152f5fdb78b6e89350b8a1a5034f2d1d3 Mon Sep 17 00:00:00 2001 From: Joanhey Date: Fri, 28 Jul 2023 19:48:10 +0200 Subject: [PATCH 01/29] Add apache dockerfile --- .docker/apache.dockerfile | 8 ++++++++ apache.sh | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 .docker/apache.dockerfile create mode 100644 apache.sh diff --git a/.docker/apache.dockerfile b/.docker/apache.dockerfile new file mode 100644 index 0000000..7ca4aec --- /dev/null +++ b/.docker/apache.dockerfile @@ -0,0 +1,8 @@ +FROM php:8.2-apache + +RUN apt-get update \ + && apt-get install -y libicu-dev + +RUN mkdir /var/www/html/PHP-Frameworks-Bench + +RUN docker-php-ext-install intl diff --git a/apache.sh b/apache.sh new file mode 100644 index 0000000..c4cb73e --- /dev/null +++ b/apache.sh @@ -0,0 +1,5 @@ +docker build --tag bench/apache -f .docker/apache.dockerfile . + +echo "Runing apache in http://127.0.0.1:8080" + +docker run -it -p 8080:80 -v "$PWD":/var/www/html/PHP-Frameworks-Bench:rw bench/apache:latest From c198c7c53582c473e51c95c1b436a334ea857576 Mon Sep 17 00:00:00 2001 From: Joanhey Date: Sat, 29 Jul 2023 12:22:02 +0200 Subject: [PATCH 02/29] Check if docker is installed --- apache.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apache.sh b/apache.sh index c4cb73e..a0ddba8 100644 --- a/apache.sh +++ b/apache.sh @@ -1,3 +1,10 @@ +#!/bin/sh + +if [ ! `which docker` ]; then + echo "docker not found." + exit 1; +fi + docker build --tag bench/apache -f .docker/apache.dockerfile . echo "Runing apache in http://127.0.0.1:8080" From 0d04c926927b6b305d9300017f73fcea4254ad12 Mon Sep 17 00:00:00 2001 From: Joanhey Date: Sat, 29 Jul 2023 12:39:52 +0200 Subject: [PATCH 03/29] Add optional port input default port 8080 --- apache.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apache.sh b/apache.sh index a0ddba8..1f0f8fb 100644 --- a/apache.sh +++ b/apache.sh @@ -5,8 +5,10 @@ if [ ! `which docker` ]; then exit 1; fi +PORT=${1:-8080} + docker build --tag bench/apache -f .docker/apache.dockerfile . -echo "Runing apache in http://127.0.0.1:8080" +echo "Runing apache in http://127.0.0.1:$PORT" -docker run -it -p 8080:80 -v "$PWD":/var/www/html/PHP-Frameworks-Bench:rw bench/apache:latest +docker run -it -p "$PORT":80 -v "$PWD":/var/www/html/PHP-Frameworks-Bench:rw bench/apache:latest From 8da746f8321ef28ff350056dbe3b74dc0a98b79b Mon Sep 17 00:00:00 2001 From: Joanhey Date: Sat, 29 Jul 2023 13:48:44 +0200 Subject: [PATCH 04/29] Add optional opcache in dockerfile --- .docker/apache.dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.docker/apache.dockerfile b/.docker/apache.dockerfile index 7ca4aec..e4e0c0d 100644 --- a/.docker/apache.dockerfile +++ b/.docker/apache.dockerfile @@ -5,4 +5,8 @@ RUN apt-get update \ RUN mkdir /var/www/html/PHP-Frameworks-Bench +# Need it in a lot of frameworks RUN docker-php-ext-install intl + +# Optional opcache (recommended) +#RUN docker-php-ext-install opcache From f9c0c9d4bc592a95b04ebbf2f0d7bcc4da59ee0e Mon Sep 17 00:00:00 2001 From: Joanhey Date: Sat, 29 Jul 2023 13:50:31 +0200 Subject: [PATCH 05/29] Remove numfmt in _functions.sh it's unnecessary and show errors --- base/_functions.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/base/_functions.sh b/base/_functions.sh index bbdf7e8..149e4f0 100755 --- a/base/_functions.sh +++ b/base/_functions.sh @@ -40,8 +40,7 @@ benchmark () { rps=`grep "Requests/sec:" "$output_wrk" | tr -cd '0-9.'` - echo "rps: " - numfmt --g "$rps" + echo "rps: $rps" # to make a small gap between the WRK and CURL sleep 1 From 43351a5c69535578729219d1ae7e6b5bfe867c8a Mon Sep 17 00:00:00 2001 From: Joanhey Date: Sat, 29 Jul 2023 14:23:55 +0200 Subject: [PATCH 06/29] Add info to stop Apache --- apache.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/apache.sh b/apache.sh index 1f0f8fb..bab5518 100644 --- a/apache.sh +++ b/apache.sh @@ -10,5 +10,6 @@ PORT=${1:-8080} docker build --tag bench/apache -f .docker/apache.dockerfile . echo "Runing apache in http://127.0.0.1:$PORT" +echo -e "Press Ctrl+C to stop. \n\n" docker run -it -p "$PORT":80 -v "$PWD":/var/www/html/PHP-Frameworks-Bench:rw bench/apache:latest From 3fdaadbd59cb7d6c0dc3fa2441d96cf0ce38d420 Mon Sep 17 00:00:00 2001 From: Joanhey Date: Sat, 29 Jul 2023 21:20:02 +0200 Subject: [PATCH 07/29] By pass docker gateway for performance reasons --- .docker/apache.dockerfile | 4 ++++ apache.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.docker/apache.dockerfile b/.docker/apache.dockerfile index e4e0c0d..75b7c73 100644 --- a/.docker/apache.dockerfile +++ b/.docker/apache.dockerfile @@ -10,3 +10,7 @@ RUN docker-php-ext-install intl # Optional opcache (recommended) #RUN docker-php-ext-install opcache + +ENV PORT 80 +ENTRYPOINT [] +CMD sed -i "s/80/$PORT/g" /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf && docker-php-entrypoint apache2-foreground diff --git a/apache.sh b/apache.sh index bab5518..42845df 100644 --- a/apache.sh +++ b/apache.sh @@ -12,4 +12,4 @@ docker build --tag bench/apache -f .docker/apache.dockerfile . echo "Runing apache in http://127.0.0.1:$PORT" echo -e "Press Ctrl+C to stop. \n\n" -docker run -it -p "$PORT":80 -v "$PWD":/var/www/html/PHP-Frameworks-Bench:rw bench/apache:latest +docker run -it --net=host -e PORT="$PORT" -v "$PWD":/var/www/html/PHP-Frameworks-Bench:rw bench/apache:latest From a23874773a897220b682365704331198f69b1e13 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Wed, 2 Aug 2023 19:15:57 +0330 Subject: [PATCH 08/29] Delete 0 Is this file a bug? --- 0 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 0 diff --git a/0 b/0 deleted file mode 100644 index f69d5ad..0000000 --- a/0 +++ /dev/null @@ -1 +0,0 @@ -8.2.8 \ No newline at end of file From 98e53de25305add254c0e9cf3997113837838855 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 10 Aug 2023 18:24:31 +0330 Subject: [PATCH 09/29] Add date to `results.log` --- base/hello_world.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/base/hello_world.sh b/base/hello_world.sh index a0dcc09..512001c 100755 --- a/base/hello_world.sh +++ b/base/hello_world.sh @@ -4,11 +4,13 @@ cd `dirname $0` . ./_functions.sh . ../benchmark.config -bm_name=`basename $0 .sh` +bn_name=`basename $0 .sh` -results_file="output/results.$bm_name.log" -check_file="output/check.$bm_name.log" -error_file="output/error.$bm_name.log" +file_time=`date +%Y-%m-%dT%H-%M-%S` + +results_file="output/results.$bn_name.$file_time.log" +check_file="output/check.$bn_name.log" +error_file="output/error.$bn_name.log" url_file="output/urls.log" cd .. From ed3a6ccd01e6d98c5c7f7dbde30815d72607dc73 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 10 Aug 2023 19:23:48 +0330 Subject: [PATCH 10/29] Fix `show-table.sh` to pick the latest file --- libs/show_results_table.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/show_results_table.php b/libs/show_results_table.php index d30474d..c9aaedb 100755 --- a/libs/show_results_table.php +++ b/libs/show_results_table.php @@ -3,6 +3,12 @@ require './libs/parse_results.php'; require './libs/build_table.php'; -$results = parse_results('./output/results.hello_world.log'); +$files = glob("./output/results.hello_world.*.log"); + +rsort($files); + +echo @$files[0].PHP_EOL; + +$results = parse_results(@$files[0]); echo build_table($results); From e5a4652e77c9eaff7c0791a1bfb6043eda07a496 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 10 Aug 2023 19:42:24 +0330 Subject: [PATCH 11/29] Fix `index.php` to pick the latest file --- index.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index 78931fd..c943292 100644 --- a/index.php +++ b/index.php @@ -12,7 +12,11 @@ $dataTime = []; $dataFile = []; - $resultsFile = __DIR__ . '/output/results.hello_world.log'; + $resultsFiles = glob("./output/results.hello_world.*.log"); + + rsort($resultsFiles); + + $resultsFile = @$resultsFiles[0]; if (file_exists($resultsFile)) { Parse_Results: { @@ -30,11 +34,11 @@ } echo " - const dataLabels = ['".implode("','",$dataLabels)."']; - const dataRPS = [".implode(",",$dataRPS)."]; - const dataMemory = [".implode(",",$dataMemory)."]; - const dataTime = [".implode(",",$dataTime)."]; - const dataFile = [".implode(",",$dataFile)."]; + const dataLabels = ['" . implode("','", $dataLabels) . "']; + const dataRPS = [" . implode(",", $dataRPS) . "]; + const dataMemory = [" . implode(",", $dataMemory) . "]; + const dataTime = [" . implode(",", $dataTime) . "]; + const dataFile = [" . implode(",", $dataFile) . "]; "; ?> @@ -54,7 +58,9 @@ " . date("Y/m/d H:i:s", filemtime($resultsFile)) . ""; + if (preg_match("/results.hello_world.(\S+).log/", @$resultsFile, $match)) { + echo "

" . $match[1] . "

"; + } ?>
@@ -75,8 +81,8 @@ foreach ($urls as $url) { $url_array = explode('/', $url); // to make it shorter - $url_array = array_slice($url_array,4); - echo "
  • .../".implode('/', $url_array)."
  • "; + $url_array = array_slice($url_array, 4); + echo "
  • .../" . implode('/', $url_array) . "
  • "; } ?> From 6cc1cd0ea5769cf087025a3fda78a39577fb606c Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 10 Aug 2023 21:22:48 +0330 Subject: [PATCH 12/29] Change `-c|--clean` to `-f|--fresh` & fixes --- README.md | 5 +++++ base/hello_world.sh | 2 +- base/option_target.sh | 11 +++++++++-- benchmark.sh | 22 +++++++++++++--------- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 561da9f..e33d7a0 100755 --- a/README.md +++ b/README.md @@ -138,6 +138,10 @@ $ bash benchmark.sh ## Commands ```bash +# some options +# use bash benchmark.sh --help +$ bash benchmark.sh -f -rapache -rnginx -t ... + # run composer update for frameworks $ bash update.sh @@ -157,6 +161,7 @@ To specify frameworks, put them with `-t ...` after each command: ```bash # supported for `setup.sh`, `benchmark.sh`, `update.sh`, `clean.sh`, and `clear-cache.sh` +# not required to put / after the name, just use the tab in your terminal # bash benchmarks.sh --help -h $ bash benchmark.sh -t laravel-10.0/ slim-4.11/ ... ... diff --git a/base/hello_world.sh b/base/hello_world.sh index 512001c..e312866 100755 --- a/base/hello_world.sh +++ b/base/hello_world.sh @@ -54,7 +54,7 @@ do # continue # fi - if [ "$param_clean" = true ]; then + if [ "$param_fresh" = true ]; then bash clean.sh bash setup.sh -t "$fw" fi diff --git a/base/option_target.sh b/base/option_target.sh index a29ec72..0b54f9e 100644 --- a/base/option_target.sh +++ b/base/option_target.sh @@ -9,7 +9,7 @@ function showHelp() { cat << HEREDOC - Usage: bash check.sh [-t pure-php/ slim-*] + Usage: bash check.sh [-t pure-php slim-*] Optional Arguments: -h, --help Show this help message and exit @@ -30,6 +30,7 @@ IFS=';' params=(`php ./libs/strreplace.php " -" ";-" " ${paramsin}"`) IFS=$oldIFS +init_benchmark=true for option in "${params[@]}" do case "$option" in @@ -41,13 +42,19 @@ do fi ;; -h|--help) + init_benchmark=false showHelp; ;; ""|" ") ;; *) + init_benchmark=false echo "\"${option}\" not available" exit 1 ;; esac -done \ No newline at end of file +done + +if [ "$init_benchmark" = false ]; then + exit 1 +fi \ No newline at end of file diff --git a/benchmark.sh b/benchmark.sh index 533eb19..2cb281e 100644 --- a/benchmark.sh +++ b/benchmark.sh @@ -21,10 +21,10 @@ function showHelp() { cat << HEREDOC - Usage: bash benchmark.sh [-c] [-rapache] [-t pure-php slim] + Usage: bash benchmark.sh [-f] [-rapache] [-t pure-php slim] Optional Arguments: - -c, --clean Clean all frameworks and install the target framework -fresh install- before benchmark. + -f, --fresh Clean all frameworks and install the target framework -fresh install- before benchmark. -h, --help Show this help message and exit -rapache, --restart-apache Restart apache "sudo systemctl restart apache2" before each benchmark. -rnginx, --restart-nginx Restart apache "sudo systemctl restart nginx" before each benchmark. @@ -35,7 +35,7 @@ HEREDOC } export param_targets="$frameworks_list" -export param_clean=false +export param_fresh=false export param_restart_apache=false export param_restart_nginx=false @@ -48,11 +48,12 @@ IFS=';' params=(`php ./libs/strreplace.php " -" ";-" " ${paramsin}"`) IFS=$oldIFS +init_benchmark=true for option in "${params[@]}" do case "$option" in - -c|--clean) - param_clean=true + -f|--fresh) + param_fresh=true ;; -rapache|--restart-apache) param_restart_apache=true @@ -68,18 +69,21 @@ do fi ;; -h|--help) + init_benchmark=false showHelp; ;; ""|" ") ;; *) + init_benchmark=false echo "\"${option}\" not available" exit 1 ;; esac done -sh ./base/hello_world.sh - -echo '' -php ./libs/show_results_table.php \ No newline at end of file +if [ "$init_benchmark" = true ]; then + sh ./base/hello_world.sh + echo '' + php ./libs/show_results_table.php +fi \ No newline at end of file From 15968c9df8cabad5230625594f3380d54df18e81 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 12:12:35 +0330 Subject: [PATCH 13/29] Changed to have a dir for each benchmark --- base/_functions.sh | 4 ++-- base/hello_world.sh | 33 ++++++++------------------------- index.php | 20 ++++++++++---------- libs/show_results_table.php | 12 +++++++----- 4 files changed, 27 insertions(+), 42 deletions(-) diff --git a/base/_functions.sh b/base/_functions.sh index 584bb52..9e04e7a 100755 --- a/base/_functions.sh +++ b/base/_functions.sh @@ -1,8 +1,8 @@ benchmark () { fw="$1" url="$2" - output_wrk="output/$fw.wrk.log" - output="output/$fw.output" + output_wrk="output/$dir_datetime/$fw.wrk.log" + output="output/$dir_datetime/$fw.output" # check out the appropriate response is reachable url_status=$(bash check.sh -t "$fw") diff --git a/base/hello_world.sh b/base/hello_world.sh index e312866..ee0f938 100755 --- a/base/hello_world.sh +++ b/base/hello_world.sh @@ -6,34 +6,17 @@ cd `dirname $0` bn_name=`basename $0 .sh` -file_time=`date +%Y-%m-%dT%H-%M-%S` +cd .. -results_file="output/results.$bn_name.$file_time.log" -check_file="output/check.$bn_name.log" -error_file="output/error.$bn_name.log" -url_file="output/urls.log" +mkdir -p output -cd .. +export dir_datetime=`date +%y-%m-%dT%H-%M-%S` +mkdir output/$dir_datetime -if [ -f "$results_file" ]; then - echo "moving $results_file to $results_file.old" - mv "$results_file" "$results_file.old" -fi - -if [ -f "$check_file" ]; then - echo "moving $check_file to $check_file.old" - mv "$check_file" "$check_file.old" -fi - -if [ -f "$error_file" ]; then - echo "moving $error_file to $error_file.old" - mv "$error_file" "$error_file.old" -fi - -if [ -f "$url_file" ]; then - echo "moving $url_file to $url_file.old" - mv "$url_file" "$url_file.old" -fi +results_file="output/$dir_datetime/results.log" +check_file="output/$dir_datetime/check.log" +error_file="output/$dir_datetime/error.log" +url_file="output/$dir_datetime/urls.log" phpc=`curl -s "$base/libs/php_config.php"` echo "/------- PHP Config -------/" diff --git a/index.php b/index.php index c943292..3019787 100644 --- a/index.php +++ b/index.php @@ -12,16 +12,16 @@ $dataTime = []; $dataFile = []; - $resultsFiles = glob("./output/results.hello_world.*.log"); + $resultsDirs = glob("./output/*", GLOB_ONLYDIR); - rsort($resultsFiles); + rsort($resultsDirs); + + $resultsDir = @$resultsDirs[0].'/results.log'; - $resultsFile = @$resultsFiles[0]; - - if (file_exists($resultsFile)) { + if (file_exists($resultsDir)) { Parse_Results: { require __DIR__ . '/libs/parse_results.php'; - $results = parse_results($resultsFile); + $results = parse_results($resultsDir); } foreach ($results as $fw => $params) { @@ -48,9 +48,9 @@

    PHP Frameworks Bench

    - output/results.hello_world.log not found! + Results not found!
    • Run bash setup.sh
    • Run bash check.sh
    • @@ -58,8 +58,8 @@
    " . $match[1] . ""; + if (preg_match("/output\/(\S+)\/results.log/", @$resultsDir, $match)) { + echo "

    " . @$match[1] . "

    "; } ?>
    diff --git a/libs/show_results_table.php b/libs/show_results_table.php index c9aaedb..2a1a388 100755 --- a/libs/show_results_table.php +++ b/libs/show_results_table.php @@ -3,12 +3,14 @@ require './libs/parse_results.php'; require './libs/build_table.php'; -$files = glob("./output/results.hello_world.*.log"); +$results = glob("./output/*", GLOB_ONLYDIR); -rsort($files); +rsort($results); -echo @$files[0].PHP_EOL; +if (preg_match("/output\/(\S+)/", @$results[0], $match)) { + echo "Results: ".@$match[1].PHP_EOL; +} -$results = parse_results(@$files[0]); +$pr = parse_results(@$results[0].'/results.log'); -echo build_table($results); +echo build_table($pr); From 1254496bca6141121449207abe639f1c6d924f2f Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 12:20:55 +0330 Subject: [PATCH 14/29] `show-table.sh` moved to `results.sh` --- show-table.sh => results.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename show-table.sh => results.sh (100%) diff --git a/show-table.sh b/results.sh similarity index 100% rename from show-table.sh rename to results.sh From 2b2fd24817a8a96459b7cb02ea214725bc61e63c Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 12:24:19 +0330 Subject: [PATCH 15/29] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e33d7a0..723bd66 100755 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ $ bash benchmark.sh - terminal: ``` - bash show-table.sh + bash results.sh ``` @@ -154,7 +154,7 @@ $ bash clean.sh $ bash clear-cache.sh # show the results of the last benchmark -$ bash show-table.sh +$ bash results.sh ``` To specify frameworks, put them with `-t ...` after each command: From 91a9ae7603696bdd4bb6413223d2224e51848c2c Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 13:23:09 +0330 Subject: [PATCH 16/29] Add Ability to define options & Add `-l | --list` --- results.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/results.sh b/results.sh index a890b03..976200a 100644 --- a/results.sh +++ b/results.sh @@ -1 +1,39 @@ -php ./libs/show_results_table.php +#!/bin/sh + +if [ ! `which php` ]; then + echo "php not found." + exit 1; +fi + +oldIFS="$IFS" +paramsin="${@%/}" +IFS='()' + +paramsin=(`php ./libs/trim.php "r" "${paramsin}"`) +IFS=';' +params=(`php ./libs/strreplace.php " -" ";-" " ${paramsin}"`) +IFS=$oldIFS + + +results=(`ls ./output/`) + +for option in "${params[@]}" +do + case "$option" in + -l|--list) + echo "List of results: " + for i in "${!results[@]}"; do + echo "$i) ${results[$i]}" + done + exit 1 + ;; + ""|" ") + ;; + *) + echo "\"${option}\" not available" + exit 1 + ;; + esac +done + +php ./libs/show_results_table.php \ No newline at end of file From a217f5dcf754c555cf799f3e6f3293a39c9eacea Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 13:47:32 +0330 Subject: [PATCH 17/29] Add more options --- results.sh | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/results.sh b/results.sh index 976200a..b8f109d 100644 --- a/results.sh +++ b/results.sh @@ -5,6 +5,22 @@ if [ ! `which php` ]; then exit 1; fi +function showHelp() +{ + cat << HEREDOC + + Usage: bash results.sh [-l] [-t 1] [-d 2] + + Optional Arguments: + -l, --list Show all results in order + + -d [index], --delete [index] Delete by index id (use --list) + -dall, --deleteall Delete all results + -h, --help Show this help message and exit + +HEREDOC +} + oldIFS="$IFS" paramsin="${@%/}" IFS='()' @@ -20,6 +36,24 @@ results=(`ls ./output/`) for option in "${params[@]}" do case "$option" in + -dall|--deleteall) + rm -rf ./output/* + ;; + -d*|--delete*) + delete=${option//--delete /} + delete=${option//-d /} + if [ ${#delete} -ge 0 ]; then + for i in "${!results[@]}"; do + if [ $delete -eq $i ]; then + echo "Delete ./output/${results[$i]}" + rm -rf "./output/${results[$i]}" + exit 1 + fi + done + echo "Index $delete not found!" + fi + exit 1 + ;; -l|--list) echo "List of results: " for i in "${!results[@]}"; do @@ -27,11 +61,14 @@ do done exit 1 ;; + -h|--help) + showHelp; + exit 1 + ;; ""|" ") ;; *) echo "\"${option}\" not available" - exit 1 ;; esac done From a0486a5162f22bfaf7e941a32dc21deda6eaf202 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 14:15:02 +0330 Subject: [PATCH 18/29] Add one more option `-t | --top` --- libs/show_results_table.php | 9 +++++++-- results.sh | 15 +++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libs/show_results_table.php b/libs/show_results_table.php index 2a1a388..c722953 100755 --- a/libs/show_results_table.php +++ b/libs/show_results_table.php @@ -7,10 +7,15 @@ rsort($results); -if (preg_match("/output\/(\S+)/", @$results[0], $match)) { +$index = 0; +if (!empty($argv[1]) && $argv[1] Date: Fri, 11 Aug 2023 14:45:43 +0330 Subject: [PATCH 19/29] Add comparison between last two results on table --- benchmark.sh | 2 +- libs/build_table.php | 34 +++++++++++++++++++++++++--------- libs/show_results_table.php | 15 ++++++++++----- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/benchmark.sh b/benchmark.sh index 2cb281e..1001f9f 100644 --- a/benchmark.sh +++ b/benchmark.sh @@ -85,5 +85,5 @@ done if [ "$init_benchmark" = true ]; then sh ./base/hello_world.sh echo '' - php ./libs/show_results_table.php + bash results.sh fi \ No newline at end of file diff --git a/libs/build_table.php b/libs/build_table.php index 79939f7..21858a7 100644 --- a/libs/build_table.php +++ b/libs/build_table.php @@ -1,6 +1,6 @@ $result) { + + foreach ($res1 as $fw => $result) { + $comp['rps'] = '(-)'; + $comp['memory'] = '(-)'; + if (!empty($res2[$fw])) { + $comp['rps'] = '(' . culc_percentage($result['rps'], $res2[$fw]['rps']) . '%)'; + $comp['memory'] = '(' . culc_percentage($result['memory'], $res2[$fw]['memory']) . '%)'; + } + $table .= sprintf( "|%-19s|%25s|%14s|%11s|%14s|\n", $fw, - number_format($result['rps'], 2), + number_format($result['rps'], 2) . ' ' . @$comp['rps'], number_format($result['rps_relative'], 1), - number_format($result['memory'], 2), + number_format($result['memory'], 2) . ' ' . @$comp['memory'], number_format($result['memory_relative'], 1) ); } return $table; } + +function culc_percentage($targetNumber, $baseNumber) +{ + $diff = $targetNumber - $baseNumber; + $percentage = ($diff / $baseNumber) * 100; + if ($percentage==0) + return 0; + return number_format($percentage, 1); +} diff --git a/libs/show_results_table.php b/libs/show_results_table.php index c722953..4098e00 100755 --- a/libs/show_results_table.php +++ b/libs/show_results_table.php @@ -8,14 +8,19 @@ rsort($results); $index = 0; -if (!empty($argv[1]) && $argv[1]= count($results)) { + echo build_table($pr); +} else { + $prComp = parse_results(@$results[$index+1] . '/results.log'); + echo build_table($pr, $prComp); +} From 78100b06856c57d11994ca31286536f4b7099675 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 15:57:47 +0330 Subject: [PATCH 20/29] No longer need it --- libs/show_comparison_table.php | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 libs/show_comparison_table.php diff --git a/libs/show_comparison_table.php b/libs/show_comparison_table.php deleted file mode 100644 index 966a634..0000000 --- a/libs/show_comparison_table.php +++ /dev/null @@ -1,28 +0,0 @@ - Date: Fri, 11 Aug 2023 16:28:10 +0330 Subject: [PATCH 21/29] Add `-c|--compare` to specify target --- libs/show_results_table.php | 25 ++++++++++++++++++++----- results.sh | 14 ++++++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/libs/show_results_table.php b/libs/show_results_table.php index 4098e00..64ff584 100755 --- a/libs/show_results_table.php +++ b/libs/show_results_table.php @@ -8,19 +8,34 @@ rsort($results); $index = 0; -if (!empty($argv[1]) && $argv[1] < count($results)) { - $index = intval($argv[1]); + +if (!empty($results[$argv[1]])) { + $index = $argv[1]; } if (preg_match("/output\/(\S+)/", @$results[$index], $match)) { - echo "Results: " . @$match[1] . PHP_EOL; + echo " Results:\t\t" . @$match[1] . PHP_EOL; +} + +$compareTo = -1; + +if (!empty($results[$argv[2]])) { + $compareTo = $argv[2]; +} else if (!empty($results[$index+1])) { + $compareTo = $index+1; } +if ($compareTo>=0 && preg_match("/output\/(\S+)/", @$results[$compareTo], $match)) { + echo " Compare to:\t\t" . @$match[1] . PHP_EOL; +} + +echo '|-------------------|------------------------:|-------------:|----------:|-------------:|'.PHP_EOL; + $pr = parse_results(@$results[$index] . '/results.log'); -if ($index + 1 >= count($results)) { +if ($compareTo<0) { echo build_table($pr); } else { - $prComp = parse_results(@$results[$index+1] . '/results.log'); + $prComp = parse_results(@$results[$compareTo] . '/results.log'); echo build_table($pr, $prComp); } diff --git a/results.sh b/results.sh index dab0923..fda7c51 100644 --- a/results.sh +++ b/results.sh @@ -9,9 +9,10 @@ function showHelp() { cat << HEREDOC - Usage: bash results.sh [-l] [-t 1] [-d 2] + Usage: bash results.sh [-t 0] [-c 3] Optional Arguments: + -c [index], --compare [index] Compare current results with (use --list) -d [index], --delete [index] Delete by index id (use --list) -dall, --deleteall Delete all results -h, --help Show this help message and exit @@ -33,12 +34,20 @@ IFS=$oldIFS results=(`ls ./output/`) index=0 +compare_to=1 for option in "${params[@]}" do case "$option" in -dall|--deleteall) rm -rf ./output/* ;; + -c*|--compare*) + compare=${option//--compare /} + compare=${option//-c /} + if [ ${#compare} -ge 0 ]; then + compare_to="$compare" + fi + ;; -d*|--delete*) delete=${option//--delete /} delete=${option//-d /} @@ -66,6 +75,7 @@ do top=${option//-t /} if [ ${#top} -ge 0 ]; then index="$top" + compare_to=$index+1 fi ;; -h|--help) @@ -80,4 +90,4 @@ do esac done -php ./libs/show_results_table.php $index \ No newline at end of file +php ./libs/show_results_table.php $index $compare_to \ No newline at end of file From e2c81ebc1888fb23c9c4244633db5ef9e6f15dca Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Fri, 11 Aug 2023 22:18:34 +0330 Subject: [PATCH 22/29] Fixes with multiple results --- index.php | 58 ++++++++++++++++++++++++++++++++++++++++++++--------- libs/app.js | 40 ++++++++++++++++++++++++++++++++---- 2 files changed, 84 insertions(+), 14 deletions(-) diff --git a/index.php b/index.php index 3019787..f9622d3 100644 --- a/index.php +++ b/index.php @@ -4,24 +4,49 @@ PHP Frameworks Bench + + + +

    PHP Frameworks Bench

    + - - - -

    PHP Frameworks Bench

    " . @$match[1] . ""; + echo "

    " . @$match[1] . "

    "; + + foreach ($resultsDirs as $res) { + if (preg_match("/output\/(\S+)/", @$res, $match)) { + echo "" . $match[1] . " | "; + } } ?>
    @@ -77,7 +115,7 @@
      Date: Thu, 24 Aug 2023 11:13:14 +0330 Subject: [PATCH 23/29] Rename `apache.sh` --- apache.sh => docker-apache.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename apache.sh => docker-apache.sh (100%) diff --git a/apache.sh b/docker-apache.sh similarity index 100% rename from apache.sh rename to docker-apache.sh From 9713999253855e47372794a4b497f5d0e93a37b0 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 24 Aug 2023 12:38:28 +0330 Subject: [PATCH 24/29] Update README.md --- README.md | 96 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 723bd66..cf6479c 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # PHP Frameworks Bench [![Test PHP benchmark](https://github.com/myaaghubi/PHP-Frameworks-Bench/actions/workflows/test.yml/badge.svg)](https://github.com/myaaghubi/PHP-Frameworks-Bench/actions/workflows/test.yml) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/myaaghubi/PHP-Frameworks-Bench?color=purpol) ![GitHub](https://img.shields.io/github/license/myaaghubi/PHP-Frameworks-Bench?color=green) + This project attempts to measure the minimum overhead (minimum bootstrap cost) of PHP frameworks in the real world. So I think the minimum should not include: @@ -16,9 +17,11 @@ Benchmarking on components like template engines or ORM/Database libraries is ou - [Benchmarks](#benchmarks) - [Latest](#latest) - [OPCache On/Off](#opcache-on) - - [Benchmarking Policy](#benchmarking-policy) - [How to Benchmark](#how-to-benchmark) + - [Docker](#docker) - [Commands](#commands) + - [Benchmarking Policy](#benchmarking-policy) + - [Add Your Framework](#add-your-framework) - [Donate](#-donate) - [References](#references) - [License](#license) @@ -41,12 +44,12 @@ Benchmarking on components like template engines or ORM/Database libraries is ou #### Results (2023/5/15) -These are my benchmarks, not yours. **I encourage you to run on your (production equivalent) environments.** +These are my benchmarks, not yours. **I encourage you to run on your -production equivalent- environments.** -![Benchmark Results Graph Throughput](screenshots/php-frameworks-bench-throughput.png) -![Benchmark Results Graph Memory](screenshots/php-frameworks-bench-memory.png) -![Benchmark Results Graph Execution Time](screenshots/php-frameworks-bench-exectime.png) -![Benchmark Results Graph Included Files](screenshots/php-frameworks-bench-includedfiles.png) +![Frameworks Benchmark Results Graph Throughput](screenshots/php-frameworks-bench-throughput.png) +![Frameworks Benchmark Results Graph Memory](screenshots/php-frameworks-bench-memory.png) +![Frameworks Benchmark Results Graph Execution Time](screenshots/php-frameworks-bench-exectime.png) +![Frameworks Benchmark Results Graph Included Files](screenshots/php-frameworks-bench-includedfiles.png) |framework |requests per second (rps)|relative (rps)|peak memory|relative (mem)| |-------------------|------------------------:|-------------:|----------:|-------------:| @@ -71,29 +74,13 @@ These are my benchmarks, not yours. **I encourage you to run on your (production #### OPCache On +Check out the video for more information. [![Results with OPCache On/Off & How to add your framework](http://img.youtube.com/vi/Dk8YHQZ6jfY/0.jpg)](http://www.youtube.com/watch?v=Dk8YHQZ6jfY) -## Benchmarking Policy - -This is for the `main` branch. - -* Frameworks installed via `composer` according to their official documentation. -* Used the default configuration. - * Considering the minimum changes on frameworks to run the benchmark. - * Didn't remove any components/configurations even if there is no use for them. -* We have a `controller` class to get the `Hello World` for each, based on the default template of each framework. -* Turned off the `debug` mode and set the environment to `production` mode. -* Considered general optimization for the production environment, like `--optimize-autoloader` for the composer. - -Some frameworks are optimized more than others, so some people may think using default configuration is not fair. The dept of optimizing a framework depends on the experiences of the developer too, so it's the rabbit hole and there is no point in it. I think the default configuration of frameworks is a good starting point to get ranking. - -If you find something wrong in my code, feel free to send a PR. But please note optimizing for the "Hello World" is not acceptable! Building the fastest `Hello World` application is not the goal of this project. - - ## How to Benchmark -If you want to have benchmarks on `PHP extension frameworks` like `Phalcon`, you need to install the extension first based on its own documentation. +If you want to have benchmarks on `PHP extension frameworks` like `Phalcon`, you need to install the extension first, based on its own documentation. 1- Download & Setup: @@ -115,32 +102,58 @@ $ yes | bash setup.sh ```bash $ bash check.sh # bash check.sh -t pure-php -# /------- pure-php: checking... done. +# ✔ pure-php ``` 3- Run benchmarks: ```bash +# bash benchmark.sh --help $ bash benchmark.sh ``` 4- Check the results: - web: - + - terminal: - ``` + ```bash + # bash results.sh --help bash results.sh ``` +## Docker + +Results with docker may not be reliable but in a situation you can use it like: + +1- Change the `base` in `benchmark.config` on the right port(`8080` considered): + +```ini +base="http://127.0.0.1:8080/PHP-Frameworks-Bench" +... +``` + +2- Run/download the docker: + +```bash +$ bash docker-apache.sh +``` + +3- Run the benchmark: + +```bash +# run it in another terminal +$ bash benchmark.sh +``` + + ## Commands ```bash -# some options # use bash benchmark.sh --help -$ bash benchmark.sh -f -rapache -rnginx -t ... +$ bash benchmark.sh -f -rapache -t pure-php # run composer update for frameworks $ bash update.sh @@ -153,7 +166,7 @@ $ bash clean.sh # clear the cache of frameworks $ bash clear-cache.sh -# show the results of the last benchmark +# show the results table $ bash results.sh ``` @@ -161,13 +174,31 @@ To specify frameworks, put them with `-t ...` after each command: ```bash # supported for `setup.sh`, `benchmark.sh`, `update.sh`, `clean.sh`, and `clear-cache.sh` -# not required to put / after the name, just use the tab in your terminal -# bash benchmarks.sh --help -h +# bash benchmarks.sh --help $ bash benchmark.sh -t laravel-10.0/ slim-4.11/ ... ... ``` +## Add Your Framework +Check out the [Benchmarking Policy](#benchmarking-policy), to get more information watch the video [OPCache On/Off](#opcache-on). + + +## Benchmarking Policy + +* Use `composer` to install frameworks according to their official documentation. +* Use the default configuration. + * Minimum changes on frameworks to have benchmarks. + * Don't remove any components/configurations even if there is no use for them. +* Include a `controller` class to get the `Hello World!` for each, based on the default template of each framework for `controllers`. +* Turn off the `debug` mode and set the environment to `production` mode. +* General optimization for the production environment, like `--optimize-autoloader` for the `composer`. + +Some frameworks are optimized more than others, so some developers may think using default configuration is not fair. The dept of optimizing a framework depends on the skills/experiences of the developer too, so it's the rabbit hole and nonsense for ranking. Please **note** optimizing for the `Hello World` is not acceptable! Building the fastest `Hello World` application is not the goal of this project. I think the default configuration of frameworks is a good starting point to have a ranking. + +If you find something wrong in my code, feel free to send a `PR`. + + ## 🍔 Donate Don't forget to donate if you find it useful ☕ 🍺 🍸 🍔 @@ -175,6 +206,7 @@ ETH: 0x0ADd51D6855d2DF11BB5F331A3fa345c67a863b2 ![Ethereum](screenshots/ethereum.jpg?raw=true "Ethereum") + ## References Note: This project is based on [php-framework-benchmark](https://github.com/kenjis/php-framework-benchmark), thanks to [Kenjis](https://github.com/kenjis). It is very old and abandoned, so I decided to split it from the origin and update it separately. From e67f106823140cde73987e09772be5a37e8a96f2 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 24 Aug 2023 12:53:15 +0330 Subject: [PATCH 25/29] Move `benchmark.config` to `config` --- benchmark.config => config | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename benchmark.config => config (100%) diff --git a/benchmark.config b/config similarity index 100% rename from benchmark.config rename to config From a5bf053d724d8d8ee664b6e347de30fc2ca83936 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 24 Aug 2023 12:54:38 +0330 Subject: [PATCH 26/29] Move `benchmark.config` to `config` --- base/hello_world.sh | 2 +- base/show_fw_array.sh | 2 +- benchmark.sh | 2 +- check.sh | 2 +- clean.sh | 2 +- clear-cache.sh | 2 +- setup.sh | 2 +- update.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/base/hello_world.sh b/base/hello_world.sh index ee0f938..439543c 100755 --- a/base/hello_world.sh +++ b/base/hello_world.sh @@ -2,7 +2,7 @@ cd `dirname $0` . ./_functions.sh -. ../benchmark.config +. ../config bn_name=`basename $0 .sh` diff --git a/base/show_fw_array.sh b/base/show_fw_array.sh index 6cef899..f5ae136 100644 --- a/base/show_fw_array.sh +++ b/base/show_fw_array.sh @@ -3,7 +3,7 @@ cd `dirname $0` cd .. -. ../benchmark.config +. ../config # include framework list targets="$frameworks_list" diff --git a/benchmark.sh b/benchmark.sh index 1001f9f..99d6e04 100644 --- a/benchmark.sh +++ b/benchmark.sh @@ -15,7 +15,7 @@ if [ ! `which curl` ]; then exit 1; fi -. ./benchmark.config +. ./config function showHelp() { diff --git a/check.sh b/check.sh index 324ccb3..7f80cb6 100755 --- a/check.sh +++ b/check.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./benchmark.config +. ./config . ./base/option_target.sh # Colors diff --git a/clean.sh b/clean.sh index b91909b..9066a1c 100644 --- a/clean.sh +++ b/clean.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./benchmark.config +. ./config . ./base/option_target.sh shopt -s extglob diff --git a/clear-cache.sh b/clear-cache.sh index 54b668c..58adc62 100755 --- a/clear-cache.sh +++ b/clear-cache.sh @@ -6,7 +6,7 @@ if [ ! `which composer` ]; then fi -. ./benchmark.config +. ./config . ./base/option_target.sh shopt -s extglob diff --git a/setup.sh b/setup.sh index 34404e9..44c3c81 100644 --- a/setup.sh +++ b/setup.sh @@ -21,7 +21,7 @@ if [ ! `which curl` ]; then fi -. ./benchmark.config +. ./config . ./base/option_target.sh for fw in $param_targets diff --git a/update.sh b/update.sh index 84e8dee..ef885ee 100644 --- a/update.sh +++ b/update.sh @@ -4,7 +4,7 @@ if [ ! `which composer` ]; then exit 1; fi -. ./benchmark.config +. ./config . ./base/option_target.sh for fw in $param_targets From a6f8bb55929dc79be6ab1d801696bfaf4673652e Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Thu, 24 Aug 2023 12:58:59 +0330 Subject: [PATCH 27/29] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf6479c..920b0fe 100755 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ $ git clone https://github.com/myaaghubi/PHP-Frameworks-Bench.git $ cd PHP-Frameworks-Bench # optional -$ nano benchmark.config +$ nano config # run the setup & follow the progress $ yes | bash setup.sh @@ -128,7 +128,7 @@ $ bash benchmark.sh Results with docker may not be reliable but in a situation you can use it like: -1- Change the `base` in `benchmark.config` on the right port(`8080` considered): +1- Change the `base` in `config` on the right port(`8080` considered): ```ini base="http://127.0.0.1:8080/PHP-Frameworks-Bench" From 9d1eb066402ab407e18f73ff909cfe7cf81bfc4b Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Sat, 26 Aug 2023 12:59:30 +0330 Subject: [PATCH 28/29] Some fixes --- libs/build_table.php | 16 ++++++++++------ libs/parse_results.php | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libs/build_table.php b/libs/build_table.php index 21858a7..ab58dbe 100644 --- a/libs/build_table.php +++ b/libs/build_table.php @@ -22,17 +22,17 @@ function build_table($res1, $res2 = null, $header = true) $comp['rps'] = '(-)'; $comp['memory'] = '(-)'; if (!empty($res2[$fw])) { - $comp['rps'] = '(' . culc_percentage($result['rps'], $res2[$fw]['rps']) . '%)'; - $comp['memory'] = '(' . culc_percentage($result['memory'], $res2[$fw]['memory']) . '%)'; + $comp['rps'] = '(' . culc_percentage($result['rps'], $res2[$fw]['rps']) . ')'; + $comp['memory'] = '(' . culc_percentage($result['memory'], $res2[$fw]['memory']) . ')'; } $table .= sprintf( "|%-19s|%25s|%14s|%11s|%14s|\n", $fw, number_format($result['rps'], 2) . ' ' . @$comp['rps'], - number_format($result['rps_relative'], 1), + is_numeric($result['rps_relative'])?number_format($result['rps_relative'], 1):$result['rps_relative'], number_format($result['memory'], 2) . ' ' . @$comp['memory'], - number_format($result['memory_relative'], 1) + is_numeric($result['memory_relative'])?number_format($result['memory_relative'], 1):$result['memory_relative'] ); } @@ -41,9 +41,13 @@ function build_table($res1, $res2 = null, $header = true) function culc_percentage($targetNumber, $baseNumber) { + if (!is_numeric($targetNumber) || !is_numeric($baseNumber) || $baseNumber<=0) { + return '-'; + } + $diff = $targetNumber - $baseNumber; $percentage = ($diff / $baseNumber) * 100; if ($percentage==0) - return 0; - return number_format($percentage, 1); + return '0%'; + return number_format($percentage, 1).'%'; } diff --git a/libs/parse_results.php b/libs/parse_results.php index eb99806..a12bf54 100644 --- a/libs/parse_results.php +++ b/libs/parse_results.php @@ -34,10 +34,10 @@ function parse_results($file) } foreach ($results as $fw => $data) { - $results[$fw]['rps_relative'] = $data['rps'] / ($min_rps); - $results[$fw]['memory_relative'] = $data['memory'] / ($min_memory); - $results[$fw]['time_relative'] = $data['time'] / ($min_time); - $results[$fw]['file_relative'] = $data['file'] / ($min_file); + $results[$fw]['rps_relative'] = $min_rps>0?$data['rps'] / ($min_rps): '-'; + $results[$fw]['memory_relative'] = $min_memory>0?$data['memory'] / ($min_memory): '-'; + $results[$fw]['time_relative'] = $min_time>0?$data['time'] / ($min_time): '-'; + $results[$fw]['file_relative'] = $min_file>0?$data['file'] / ($min_file): '-'; } array_multisort(array_column($results, 'rps'), SORT_DESC, $results); From 49d94a7fc29c0940b6f5eddfbc458bfe97620942 Mon Sep 17 00:00:00 2001 From: Mohammad Yaaghubi Date: Sat, 26 Aug 2023 13:49:47 +0330 Subject: [PATCH 29/29] Fix CI 4.3 fail --- codeigniter-4.3/.gitignore | 127 + codeigniter-4.3/LICENSE | 22 + codeigniter-4.3/README.md | 62 + .../_benchmark/codeigniter/public/index.php | 26 +- codeigniter-4.3/app/Common.php | 15 + codeigniter-4.3/app/Config/App.php | 178 ++ codeigniter-4.3/app/Config/Autoload.php | 100 + .../app/Config/Boot/development.php | 32 + .../app/Config/Boot/production.php | 21 + codeigniter-4.3/app/Config/Boot/testing.php | 32 + codeigniter-4.3/app/Config/CURLRequest.php | 20 + codeigniter-4.3/app/Config/Cache.php | 172 ++ codeigniter-4.3/app/Config/Constants.php | 94 + .../app/Config/ContentSecurityPolicy.php | 176 ++ codeigniter-4.3/app/Config/Cookie.php | 107 + codeigniter-4.3/app/Config/Database.php | 85 + codeigniter-4.3/app/Config/DocTypes.php | 43 + codeigniter-4.3/app/Config/Email.php | 117 + codeigniter-4.3/app/Config/Encryption.php | 92 + codeigniter-4.3/app/Config/Events.php | 55 + codeigniter-4.3/app/Config/Exceptions.php | 104 + codeigniter-4.3/app/Config/Feature.php | 30 + codeigniter-4.3/app/Config/Filters.php | 70 + .../app/Config/ForeignCharacters.php | 9 + codeigniter-4.3/app/Config/Format.php | 77 + codeigniter-4.3/app/Config/Generators.php | 42 + codeigniter-4.3/app/Config/Honeypot.php | 42 + codeigniter-4.3/app/Config/Images.php | 31 + codeigniter-4.3/app/Config/Kint.php | 69 + codeigniter-4.3/app/Config/Logger.php | 148 ++ codeigniter-4.3/app/Config/Migrations.php | 52 + codeigniter-4.3/app/Config/Mimes.php | 532 ++++ codeigniter-4.3/app/Config/Modules.php | 82 + codeigniter-4.3/app/Config/Pager.php | 37 + codeigniter-4.3/app/Config/Paths.php | 75 + codeigniter-4.3/app/Config/Publisher.php | 28 + codeigniter-4.3/app/Config/Routes.php | 54 + codeigniter-4.3/app/Config/Routing.php | 113 + codeigniter-4.3/app/Config/Security.php | 101 + codeigniter-4.3/app/Config/Services.php | 32 + codeigniter-4.3/app/Config/Session.php | 102 + codeigniter-4.3/app/Config/Toolbar.php | 118 + codeigniter-4.3/app/Config/UserAgents.php | 252 ++ codeigniter-4.3/app/Config/Validation.php | 44 + codeigniter-4.3/app/Config/View.php | 56 + .../app/Controllers/BaseController.php | 58 + .../app/Controllers/HelloWorldController.php | 12 + codeigniter-4.3/app/Controllers/Home.php | 11 + .../app/Database/Migrations/.gitkeep | 0 codeigniter-4.3/app/Database/Seeds/.gitkeep | 0 codeigniter-4.3/app/Filters/.gitkeep | 0 codeigniter-4.3/app/Helpers/.gitkeep | 0 codeigniter-4.3/app/Language/.gitkeep | 0 .../app/Language/en/Validation.php | 4 + codeigniter-4.3/app/Libraries/.gitkeep | 0 codeigniter-4.3/app/Models/.gitkeep | 0 codeigniter-4.3/app/ThirdParty/.gitkeep | 0 .../app/Views/errors/cli/error_404.php | 7 + .../app/Views/errors/cli/error_exception.php | 65 + .../app/Views/errors/cli/production.php | 5 + .../app/Views/errors/html/debug.css | 197 ++ .../app/Views/errors/html/debug.js | 116 + .../app/Views/errors/html/error_404.php | 84 + .../app/Views/errors/html/error_exception.php | 392 +++ .../app/Views/errors/html/production.php | 25 + codeigniter-4.3/app/Views/welcome_message.php | 325 +++ codeigniter-4.3/app/index.html | 11 + codeigniter-4.3/builds | 125 + codeigniter-4.3/composer.json | 39 + codeigniter-4.3/composer.lock | 2179 +++++++++++++++++ codeigniter-4.3/env | 143 ++ codeigniter-4.3/phpunit.xml.dist | 57 + codeigniter-4.3/preload.php | 113 + codeigniter-4.3/public/favicon.ico | Bin 0 -> 5430 bytes codeigniter-4.3/public/index.php | 91 + codeigniter-4.3/public/robots.txt | 2 + codeigniter-4.3/spark | 104 + codeigniter-4.3/tests/README.md | 122 + .../2020-02-22-222222_example_migration.php | 37 + .../_support/Database/Seeds/ExampleSeeder.php | 41 + .../tests/_support/Libraries/ConfigReader.php | 17 + .../tests/_support/Models/ExampleModel.php | 24 + .../tests/database/ExampleDatabaseTest.php | 46 + .../tests/session/ExampleSessionTest.php | 18 + codeigniter-4.3/tests/unit/HealthTest.php | 50 + codeigniter-4.3/writable/cache/index.html | 11 + codeigniter-4.3/writable/logs/index.html | 11 + codeigniter-4.3/writable/session/index.html | 11 + codeigniter-4.3/writable/uploads/index.html | 11 + 89 files changed, 8437 insertions(+), 3 deletions(-) create mode 100644 codeigniter-4.3/.gitignore create mode 100644 codeigniter-4.3/LICENSE create mode 100644 codeigniter-4.3/README.md create mode 100644 codeigniter-4.3/app/Common.php create mode 100644 codeigniter-4.3/app/Config/App.php create mode 100644 codeigniter-4.3/app/Config/Autoload.php create mode 100644 codeigniter-4.3/app/Config/Boot/development.php create mode 100644 codeigniter-4.3/app/Config/Boot/production.php create mode 100644 codeigniter-4.3/app/Config/Boot/testing.php create mode 100644 codeigniter-4.3/app/Config/CURLRequest.php create mode 100644 codeigniter-4.3/app/Config/Cache.php create mode 100644 codeigniter-4.3/app/Config/Constants.php create mode 100644 codeigniter-4.3/app/Config/ContentSecurityPolicy.php create mode 100644 codeigniter-4.3/app/Config/Cookie.php create mode 100644 codeigniter-4.3/app/Config/Database.php create mode 100755 codeigniter-4.3/app/Config/DocTypes.php create mode 100644 codeigniter-4.3/app/Config/Email.php create mode 100644 codeigniter-4.3/app/Config/Encryption.php create mode 100644 codeigniter-4.3/app/Config/Events.php create mode 100644 codeigniter-4.3/app/Config/Exceptions.php create mode 100644 codeigniter-4.3/app/Config/Feature.php create mode 100644 codeigniter-4.3/app/Config/Filters.php create mode 100644 codeigniter-4.3/app/Config/ForeignCharacters.php create mode 100644 codeigniter-4.3/app/Config/Format.php create mode 100644 codeigniter-4.3/app/Config/Generators.php create mode 100644 codeigniter-4.3/app/Config/Honeypot.php create mode 100644 codeigniter-4.3/app/Config/Images.php create mode 100644 codeigniter-4.3/app/Config/Kint.php create mode 100644 codeigniter-4.3/app/Config/Logger.php create mode 100644 codeigniter-4.3/app/Config/Migrations.php create mode 100644 codeigniter-4.3/app/Config/Mimes.php create mode 100644 codeigniter-4.3/app/Config/Modules.php create mode 100644 codeigniter-4.3/app/Config/Pager.php create mode 100644 codeigniter-4.3/app/Config/Paths.php create mode 100644 codeigniter-4.3/app/Config/Publisher.php create mode 100644 codeigniter-4.3/app/Config/Routes.php create mode 100644 codeigniter-4.3/app/Config/Routing.php create mode 100644 codeigniter-4.3/app/Config/Security.php create mode 100644 codeigniter-4.3/app/Config/Services.php create mode 100644 codeigniter-4.3/app/Config/Session.php create mode 100644 codeigniter-4.3/app/Config/Toolbar.php create mode 100644 codeigniter-4.3/app/Config/UserAgents.php create mode 100644 codeigniter-4.3/app/Config/Validation.php create mode 100644 codeigniter-4.3/app/Config/View.php create mode 100644 codeigniter-4.3/app/Controllers/BaseController.php create mode 100755 codeigniter-4.3/app/Controllers/HelloWorldController.php create mode 100644 codeigniter-4.3/app/Controllers/Home.php create mode 100644 codeigniter-4.3/app/Database/Migrations/.gitkeep create mode 100644 codeigniter-4.3/app/Database/Seeds/.gitkeep create mode 100644 codeigniter-4.3/app/Filters/.gitkeep create mode 100644 codeigniter-4.3/app/Helpers/.gitkeep create mode 100644 codeigniter-4.3/app/Language/.gitkeep create mode 100644 codeigniter-4.3/app/Language/en/Validation.php create mode 100644 codeigniter-4.3/app/Libraries/.gitkeep create mode 100644 codeigniter-4.3/app/Models/.gitkeep create mode 100644 codeigniter-4.3/app/ThirdParty/.gitkeep create mode 100644 codeigniter-4.3/app/Views/errors/cli/error_404.php create mode 100644 codeigniter-4.3/app/Views/errors/cli/error_exception.php create mode 100644 codeigniter-4.3/app/Views/errors/cli/production.php create mode 100644 codeigniter-4.3/app/Views/errors/html/debug.css create mode 100644 codeigniter-4.3/app/Views/errors/html/debug.js create mode 100644 codeigniter-4.3/app/Views/errors/html/error_404.php create mode 100644 codeigniter-4.3/app/Views/errors/html/error_exception.php create mode 100644 codeigniter-4.3/app/Views/errors/html/production.php create mode 100644 codeigniter-4.3/app/Views/welcome_message.php create mode 100644 codeigniter-4.3/app/index.html create mode 100755 codeigniter-4.3/builds create mode 100644 codeigniter-4.3/composer.json create mode 100644 codeigniter-4.3/composer.lock create mode 100644 codeigniter-4.3/env create mode 100644 codeigniter-4.3/phpunit.xml.dist create mode 100644 codeigniter-4.3/preload.php create mode 100644 codeigniter-4.3/public/favicon.ico create mode 100644 codeigniter-4.3/public/index.php create mode 100644 codeigniter-4.3/public/robots.txt create mode 100755 codeigniter-4.3/spark create mode 100644 codeigniter-4.3/tests/README.md create mode 100644 codeigniter-4.3/tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php create mode 100644 codeigniter-4.3/tests/_support/Database/Seeds/ExampleSeeder.php create mode 100644 codeigniter-4.3/tests/_support/Libraries/ConfigReader.php create mode 100644 codeigniter-4.3/tests/_support/Models/ExampleModel.php create mode 100644 codeigniter-4.3/tests/database/ExampleDatabaseTest.php create mode 100644 codeigniter-4.3/tests/session/ExampleSessionTest.php create mode 100644 codeigniter-4.3/tests/unit/HealthTest.php create mode 100755 codeigniter-4.3/writable/cache/index.html create mode 100755 codeigniter-4.3/writable/logs/index.html create mode 100755 codeigniter-4.3/writable/session/index.html create mode 100755 codeigniter-4.3/writable/uploads/index.html diff --git a/codeigniter-4.3/.gitignore b/codeigniter-4.3/.gitignore new file mode 100644 index 0000000..11abea6 --- /dev/null +++ b/codeigniter-4.3/.gitignore @@ -0,0 +1,127 @@ +#------------------------- +# Operating Specific Junk Files +#------------------------- + +# OS X +.DS_Store +.AppleDouble +.LSOverride + +# OS X Thumbnails +._* + +# Windows image file caches +Thumbs.db +ehthumbs.db +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Linux +*~ + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +#------------------------- +# Environment Files +#------------------------- +# These should never be under version control, +# as it poses a security risk. +.env +.vagrant +Vagrantfile + +#------------------------- +# Temporary Files +#------------------------- +writable/cache/* +!writable/cache/index.html + +writable/logs/* +!writable/logs/index.html + +writable/session/* +!writable/session/index.html + +writable/uploads/* +!writable/uploads/index.html + +writable/debugbar/* + +php_errors.log + +#------------------------- +# User Guide Temp Files +#------------------------- +user_guide_src/build/* +user_guide_src/cilexer/build/* +user_guide_src/cilexer/dist/* +user_guide_src/cilexer/pycilexer.egg-info/* + +#------------------------- +# Test Files +#------------------------- +tests/coverage* + +# Don't save phpunit under version control. +phpunit + +#------------------------- +# Composer +#------------------------- +vendor/ + +#------------------------- +# IDE / Development Files +#------------------------- + +# Modules Testing +_modules/* + +# phpenv local config +.php-version + +# Jetbrains editors (PHPStorm, etc) +.idea/ +*.iml + +# Netbeans +nbproject/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml +.nb-gradle/ + +# Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +.phpintel +/api/ + +# Visual Studio Code +.vscode/ + +/results/ +/phpunit*.xml +/.phpunit.*.cache + diff --git a/codeigniter-4.3/LICENSE b/codeigniter-4.3/LICENSE new file mode 100644 index 0000000..0119e5f --- /dev/null +++ b/codeigniter-4.3/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014-2019 British Columbia Institute of Technology +Copyright (c) 2019-2023 CodeIgniter Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/codeigniter-4.3/README.md b/codeigniter-4.3/README.md new file mode 100644 index 0000000..461e949 --- /dev/null +++ b/codeigniter-4.3/README.md @@ -0,0 +1,62 @@ +# CodeIgniter 4 Application Starter + +## What is CodeIgniter? + +CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure. +More information can be found at the [official site](https://codeigniter.com). + +This repository holds a composer-installable app starter. +It has been built from the +[development repository](https://github.com/codeigniter4/CodeIgniter4). + +More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums. + +The user guide corresponding to the latest version of the framework can be found +[here](https://codeigniter4.github.io/userguide/). + +## Installation & updates + +`composer create-project codeigniter4/appstarter` then `composer update` whenever +there is a new release of the framework. + +When updating, check the release notes to see if there are any changes you might need to apply +to your `app` folder. The affected files can be copied or merged from +`vendor/codeigniter4/framework/app`. + +## Setup + +Copy `env` to `.env` and tailor for your app, specifically the baseURL +and any database settings. + +## Important Change with index.php + +`index.php` is no longer in the root of the project! It has been moved inside the *public* folder, +for better security and separation of components. + +This means that you should configure your web server to "point" to your project's *public* folder, and +not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the +framework are exposed. + +**Please** read the user guide for a better explanation of how CI4 works! + +## Repository Management + +We use GitHub issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages. +We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss +FEATURE REQUESTS. + +This repository is a "distribution" one, built by our release preparation script. +Problems with it can be raised on our forum, or as issues in the main repository. + +## Server Requirements + +PHP version 7.4 or higher is required, with the following extensions installed: + +- [intl](http://php.net/manual/en/intl.requirements.php) +- [mbstring](http://php.net/manual/en/mbstring.installation.php) + +Additionally, make sure that the following extensions are enabled in your PHP: + +- json (enabled by default - don't turn it off) +- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL +- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library diff --git a/codeigniter-4.3/_benchmark/codeigniter/public/index.php b/codeigniter-4.3/_benchmark/codeigniter/public/index.php index 07b9869..efed459 100755 --- a/codeigniter-4.3/_benchmark/codeigniter/public/index.php +++ b/codeigniter-4.3/_benchmark/codeigniter/public/index.php @@ -16,7 +16,9 @@ define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR); // Ensure the current directory is pointing to the front controller's directory -chdir(FCPATH); +if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) { + chdir(FCPATH); +} /* *--------------------------------------------------------------- @@ -41,13 +43,23 @@ require_once SYSTEMPATH . 'Config/DotEnv.php'; (new CodeIgniter\Config\DotEnv(ROOTPATH))->load(); +// Define ENVIRONMENT +if (! defined('ENVIRONMENT')) { + define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production')); +} + +// Load Config Cache +// $factoriesCache = new \CodeIgniter\Cache\FactoriesCache(); +// $factoriesCache->load('config'); +// ^^^ Uncomment these lines if you want to use Config Caching. + /* * --------------------------------------------------------------- * GRAB OUR CODEIGNITER INSTANCE * --------------------------------------------------------------- * * The CodeIgniter class contains the core functionality to make - * the application run, and does all of the dirty work to get + * the application run, and does all the dirty work to get * the pieces all working together. */ @@ -60,12 +72,20 @@ *--------------------------------------------------------------- * LAUNCH THE APPLICATION *--------------------------------------------------------------- - * Now that everything is setup, it's time to actually fire + * Now that everything is set up, it's time to actually fire * up the engines and make this app do its thang. */ $app->run(); +// Save Config Cache +// $factoriesCache->save('config'); +// ^^^ Uncomment this line if you want to use Config Caching. + +// Exits the application, setting the exit code for CLI-based applications +// that might be watching. +// exit(EXIT_SUCCESS); + /* *** PHP-Frameworks-Bench *** */ require $_SERVER['DOCUMENT_ROOT'].'/PHP-Frameworks-Bench/libs/output_data.php'; \ No newline at end of file diff --git a/codeigniter-4.3/app/Common.php b/codeigniter-4.3/app/Common.php new file mode 100644 index 0000000..95f5544 --- /dev/null +++ b/codeigniter-4.3/app/Common.php @@ -0,0 +1,15 @@ + + */ + public array $allowedHostnames = []; + + /** + * -------------------------------------------------------------------------- + * Index File + * -------------------------------------------------------------------------- + * + * Typically this will be your index.php file, unless you've renamed it to + * something else. If you are using mod_rewrite to remove the page set this + * variable so that it is blank. + */ + public string $indexPage = 'index.php'; + + /** + * -------------------------------------------------------------------------- + * URI PROTOCOL + * -------------------------------------------------------------------------- + * + * This item determines which server global should be used to retrieve the + * URI string. The default setting of 'REQUEST_URI' works for most servers. + * If your links do not seem to work, try one of the other delicious flavors: + * + * 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] + * 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] + * 'PATH_INFO' Uses $_SERVER['PATH_INFO'] + * + * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! + */ + public string $uriProtocol = 'REQUEST_URI'; + + /** + * -------------------------------------------------------------------------- + * Default Locale + * -------------------------------------------------------------------------- + * + * The Locale roughly represents the language and location that your visitor + * is viewing the site from. It affects the language strings and other + * strings (like currency markers, numbers, etc), that your program + * should run under for this request. + */ + public string $defaultLocale = 'en'; + + /** + * -------------------------------------------------------------------------- + * Negotiate Locale + * -------------------------------------------------------------------------- + * + * If true, the current Request object will automatically determine the + * language to use based on the value of the Accept-Language header. + * + * If false, no automatic detection will be performed. + */ + public bool $negotiateLocale = false; + + /** + * -------------------------------------------------------------------------- + * Supported Locales + * -------------------------------------------------------------------------- + * + * If $negotiateLocale is true, this array lists the locales supported + * by the application in descending order of priority. If no match is + * found, the first locale will be used. + * + * IncomingRequest::setLocale() also uses this list. + * + * @var string[] + */ + public array $supportedLocales = ['en']; + + /** + * -------------------------------------------------------------------------- + * Application Timezone + * -------------------------------------------------------------------------- + * + * The default timezone that will be used in your application to display + * dates with the date helper, and can be retrieved through app_timezone() + * + * @see https://www.php.net/manual/en/timezones.php for list of timezones supported by PHP. + */ + public string $appTimezone = 'UTC'; + + /** + * -------------------------------------------------------------------------- + * Default Character Set + * -------------------------------------------------------------------------- + * + * This determines which character set is used by default in various methods + * that require a character set to be provided. + * + * @see http://php.net/htmlspecialchars for a list of supported charsets. + */ + public string $charset = 'UTF-8'; + + /** + * -------------------------------------------------------------------------- + * Force Global Secure Requests + * -------------------------------------------------------------------------- + * + * If true, this will force every request made to this application to be + * made via a secure connection (HTTPS). If the incoming request is not + * secure, the user will be redirected to a secure version of the page + * and the HTTP Strict Transport Security header will be set. + */ + public bool $forceGlobalSecureRequests = false; + + /** + * -------------------------------------------------------------------------- + * Reverse Proxy IPs + * -------------------------------------------------------------------------- + * + * If your server is behind a reverse proxy, you must whitelist the proxy + * IP addresses from which CodeIgniter should trust headers such as + * X-Forwarded-For or Client-IP in order to properly identify + * the visitor's IP address. + * + * You need to set a proxy IP address or IP address with subnets and + * the HTTP header for the client IP address. + * + * Here are some examples: + * [ + * '10.0.1.200' => 'X-Forwarded-For', + * '192.168.5.0/24' => 'X-Real-IP', + * ] + * + * @var array + */ + public array $proxyIPs = []; + + /** + * -------------------------------------------------------------------------- + * Content Security Policy + * -------------------------------------------------------------------------- + * + * Enables the Response's Content Secure Policy to restrict the sources that + * can be used for images, scripts, CSS files, audio, video, etc. If enabled, + * the Response object will populate default values for the policy from the + * `ContentSecurityPolicy.php` file. Controllers can always add to those + * restrictions at run time. + * + * For a better understanding of CSP, see these documents: + * + * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/ + * @see http://www.w3.org/TR/CSP/ + */ + public bool $CSPEnabled = false; +} diff --git a/codeigniter-4.3/app/Config/Autoload.php b/codeigniter-4.3/app/Config/Autoload.php new file mode 100644 index 0000000..e9ee661 --- /dev/null +++ b/codeigniter-4.3/app/Config/Autoload.php @@ -0,0 +1,100 @@ + SYSTEMPATH, + * 'App' => APPPATH + * ]; + * + * @var array|string> + * @phpstan-var array> + */ + public $psr4 = [ + APP_NAMESPACE => APPPATH, // For custom app namespace + 'Config' => APPPATH . 'Config', + ]; + + /** + * ------------------------------------------------------------------- + * Class Map + * ------------------------------------------------------------------- + * The class map provides a map of class names and their exact + * location on the drive. Classes loaded in this manner will have + * slightly faster performance because they will not have to be + * searched for within one or more directories as they would if they + * were being autoloaded through a namespace. + * + * Prototype: + * $classmap = [ + * 'MyClass' => '/path/to/class/file.php' + * ]; + * + * @var array + */ + public $classmap = []; + + /** + * ------------------------------------------------------------------- + * Files + * ------------------------------------------------------------------- + * The files array provides a list of paths to __non-class__ files + * that will be autoloaded. This can be useful for bootstrap operations + * or for loading functions. + * + * Prototype: + * $files = [ + * '/path/to/my/file.php', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $files = []; + + /** + * ------------------------------------------------------------------- + * Helpers + * ------------------------------------------------------------------- + * Prototype: + * $helpers = [ + * 'form', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $helpers = []; +} diff --git a/codeigniter-4.3/app/Config/Boot/development.php b/codeigniter-4.3/app/Config/Boot/development.php new file mode 100644 index 0000000..05a8612 --- /dev/null +++ b/codeigniter-4.3/app/Config/Boot/development.php @@ -0,0 +1,32 @@ + + */ + public array $file = [ + 'storePath' => WRITEPATH . 'cache/', + 'mode' => 0640, + ]; + + /** + * ------------------------------------------------------------------------- + * Memcached settings + * ------------------------------------------------------------------------- + * Your Memcached servers can be specified below, if you are using + * the Memcached drivers. + * + * @see https://codeigniter.com/user_guide/libraries/caching.html#memcached + * + * @var array + */ + public array $memcached = [ + 'host' => '127.0.0.1', + 'port' => 11211, + 'weight' => 1, + 'raw' => false, + ]; + + /** + * ------------------------------------------------------------------------- + * Redis settings + * ------------------------------------------------------------------------- + * Your Redis server can be specified below, if you are using + * the Redis or Predis drivers. + * + * @var array + */ + public array $redis = [ + 'host' => '127.0.0.1', + 'password' => null, + 'port' => 6379, + 'timeout' => 0, + 'database' => 0, + ]; + + /** + * -------------------------------------------------------------------------- + * Available Cache Handlers + * -------------------------------------------------------------------------- + * + * This is an array of cache engine alias' and class names. Only engines + * that are listed here are allowed to be used. + * + * @var array + * @phpstan-var array> + */ + public array $validHandlers = [ + 'dummy' => DummyHandler::class, + 'file' => FileHandler::class, + 'memcached' => MemcachedHandler::class, + 'predis' => PredisHandler::class, + 'redis' => RedisHandler::class, + 'wincache' => WincacheHandler::class, + ]; +} diff --git a/codeigniter-4.3/app/Config/Constants.php b/codeigniter-4.3/app/Config/Constants.php new file mode 100644 index 0000000..47b92f8 --- /dev/null +++ b/codeigniter-4.3/app/Config/Constants.php @@ -0,0 +1,94 @@ +` element. + * + * Will default to self if not overridden + * + * @var string|string[]|null + */ + public $baseURI; + + /** + * Lists the URLs for workers and embedded frame contents + * + * @var string|string[] + */ + public $childSrc = 'self'; + + /** + * Limits the origins that you can connect to (via XHR, + * WebSockets, and EventSource). + * + * @var string|string[] + */ + public $connectSrc = 'self'; + + /** + * Specifies the origins that can serve web fonts. + * + * @var string|string[] + */ + public $fontSrc; + + /** + * Lists valid endpoints for submission from `
      ` tags. + * + * @var string|string[] + */ + public $formAction = 'self'; + + /** + * Specifies the sources that can embed the current page. + * This directive applies to ``, `