diff --git a/.docker/apache.dockerfile b/.docker/apache.dockerfile new file mode 100644 index 0000000..75b7c73 --- /dev/null +++ b/.docker/apache.dockerfile @@ -0,0 +1,16 @@ +FROM php:8.2-apache + +RUN apt-get update \ + && apt-get install -y libicu-dev + +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 + +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/README.md b/README.md index 561da9f..920b0fe 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: @@ -104,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 @@ -115,29 +102,59 @@ $ 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 ``` - bash show-table.sh - ``` + + +## Docker + +Results with docker may not be reliable but in a situation you can use it like: + +1- Change the `base` in `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 +# use bash benchmark.sh --help +$ bash benchmark.sh -f -rapache -t pure-php + # run composer update for frameworks $ bash update.sh @@ -149,20 +166,39 @@ $ bash clean.sh # clear the cache of frameworks $ bash clear-cache.sh -# show the results of the last benchmark -$ bash show-table.sh +# show the results table +$ bash results.sh ``` 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` -# 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 ☕ 🍺 🍸 🍔 @@ -170,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. diff --git a/base/_functions.sh b/base/_functions.sh index 584bb52..19a3c47 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") @@ -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 diff --git a/base/hello_world.sh b/base/hello_world.sh index a0dcc09..439543c 100755 --- a/base/hello_world.sh +++ b/base/hello_world.sh @@ -2,36 +2,21 @@ cd `dirname $0` . ./_functions.sh -. ../benchmark.config +. ../config -bm_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" -url_file="output/urls.log" +bn_name=`basename $0 .sh` cd .. -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 +mkdir -p output -if [ -f "$error_file" ]; then - echo "moving $error_file to $error_file.old" - mv "$error_file" "$error_file.old" -fi +export dir_datetime=`date +%y-%m-%dT%H-%M-%S` +mkdir output/$dir_datetime -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 -------/" @@ -52,7 +37,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/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 533eb19..99d6e04 100644 --- a/benchmark.sh +++ b/benchmark.sh @@ -15,16 +15,16 @@ if [ ! `which curl` ]; then exit 1; fi -. ./benchmark.config +. ./config 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 '' + bash results.sh +fi \ No newline at end of file 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/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 ``, `