diff --git a/.env.example b/.env.example index 7643033..4bf4b95 100644 --- a/.env.example +++ b/.env.example @@ -21,16 +21,9 @@ CI_ENVIRONMENT = development #-------------------------------------------------------------------- app.baseURL = 'http://localhost:8080' +# If you have trouble with `.`, you could also use `_`. +# app_baseURL = '' # app.forceGlobalSecureRequests = false - -# app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler' -# app.sessionCookieName = 'ci_session' -# app.sessionExpiration = 7200 -# app.sessionSavePath = NULL -# app.sessionMatchIP = false -# app.sessionTimeToUpdate = 300 -# app.sessionRegenerateDestroy = false - # app.CSPEnabled = false #-------------------------------------------------------------------- @@ -41,11 +34,12 @@ database.default.database = ../writable/database.db database.default.DBDriver = SQLite3 # database.tests.hostname = localhost -# database.tests.database = ci4 +# database.tests.database = ci4_test # database.tests.username = root # database.tests.password = root # database.tests.DBDriver = MySQLi # database.tests.DBPrefix = +# database.tests.port = 3306 #-------------------------------------------------------------------- # CONTENT SECURITY POLICY @@ -56,7 +50,7 @@ database.default.DBDriver = SQLite3 # contentsecuritypolicy.scriptSrc = 'self' # contentsecuritypolicy.styleSrc = 'self' # contentsecuritypolicy.imageSrc = 'self' -# contentsecuritypolicy.base_uri = null +# contentsecuritypolicy.baseURI = null # contentsecuritypolicy.childSrc = null # contentsecuritypolicy.connectSrc = 'self' # contentsecuritypolicy.fontSrc = null @@ -69,6 +63,9 @@ database.default.DBDriver = SQLite3 # contentsecuritypolicy.reportURI = null # contentsecuritypolicy.sandbox = false # contentsecuritypolicy.upgradeInsecureRequests = false +# contentsecuritypolicy.styleNonceTag = '{csp-style-nonce}' +# contentsecuritypolicy.scriptNonceTag = '{csp-script-nonce}' +# contentsecuritypolicy.autoNonce = true #-------------------------------------------------------------------- # COOKIE @@ -106,16 +103,36 @@ database.default.DBDriver = SQLite3 # SECURITY #-------------------------------------------------------------------- +# security.csrfProtection = 'cookie' +# security.tokenRandomize = false # security.tokenName = 'csrf_token_name' # security.headerName = 'X-CSRF-TOKEN' # security.cookieName = 'csrf_cookie_name' # security.expires = 7200 # security.regenerate = true -# security.redirect = true +# security.redirect = false # security.samesite = 'Lax' +#-------------------------------------------------------------------- +# SESSION +#-------------------------------------------------------------------- + +# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' +# session.cookieName = 'ci_session' +# session.expiration = 7200 +# session.savePath = null +# session.matchIP = false +# session.timeToUpdate = 300 +# session.regenerateDestroy = false + #-------------------------------------------------------------------- # LOGGER #-------------------------------------------------------------------- # logger.threshold = 4 + +#-------------------------------------------------------------------- +# CURLRequest +#-------------------------------------------------------------------- + +# curlrequest.shareOptions = true diff --git a/README.md b/README.md index 86936d4..8283f5e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To setup a working playground on your own local device, read through the next se In order to get the playground setup on your own computer, you'll need a few minimum requirements - all of which are listed on [CodeIgniter's repo](https://github.com/codeigniter4/CodeIgniter4#server-requirements). Basically, -as long as you are running PHP 7.2 or later you'll meet most of them. +as long as you are running PHP 7.4 or later you'll meet most of them. While CodeIgniter does not require it, using this repo also requires the use of [Composer](https://getcomposer.org/) to install CodeIgniter as a dependency, and PHPUnit - the test framework. @@ -40,14 +40,16 @@ With those out of the way, it only takes a few small steps to get the project up 1 - Clone the repo if you haven't already, from the CLI: - git clone https://github.com/codeigniter4projects/playground +```console +git clone https://github.com/codeigniter4projects/playground +``` That creates a new directory, `playground`, under your current directory. 2 - Enter the new directory and install the project dependencies with Composer. NOTE: The command shown here assumes that you have Composer loaded globally. If you don't, then pretend we're using `composer.phar`. -``` +```console cd playground composer install ``` @@ -66,7 +68,7 @@ composer install 4 - Back on the command line, we install all of the needed database tables and sample data. -``` +```console php spark migrate php spark db:seed PlaygroundSeeder ``` @@ -74,11 +76,15 @@ php spark db:seed PlaygroundSeeder 5 - That's it! If you're hosting through Apache, Nginx, etc, then head to your site. If you just want a quick way to work with your site locally, go back to the CLI and start up `spark`, CodeIgniter's small server. - php spark serve +```console +php spark serve +``` If you get would like to change the port it's running on, that's no problem: - php spark serve --port 8081 +```console +php spark serve --port 8081 +``` Enjoy! diff --git a/app/Config/Boot/development.php b/app/Config/Boot/development.php index 05a8612..aa8099a 100644 --- a/app/Config/Boot/development.php +++ b/app/Config/Boot/development.php @@ -7,6 +7,8 @@ | In development, we want to show as many errors as possible to help | make sure they don't make it to production. And save us hours of | painful debugging. + | + | If you set 'display_errors' to '1', CI4's detailed error report will show. */ error_reporting(-1); ini_set('display_errors', '1'); diff --git a/app/Config/Boot/production.php b/app/Config/Boot/production.php index 21d2580..73c7c60 100644 --- a/app/Config/Boot/production.php +++ b/app/Config/Boot/production.php @@ -6,6 +6,8 @@ |-------------------------------------------------------------------------- | Don't show ANY in production environments. Instead, let the system catch | it and display a generic error message. + | + | If you set 'display_errors' to '1', CI4's detailed error report will show. */ ini_set('display_errors', '0'); error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); diff --git a/app/Config/Boot/testing.php b/app/Config/Boot/testing.php index e07a1d4..e84670e 100644 --- a/app/Config/Boot/testing.php +++ b/app/Config/Boot/testing.php @@ -1,5 +1,11 @@ - * @phpstan-var array + * @var array|string> [filter_name => classname] + * or [filter_name => [classname1, classname2, ...]] + * @phpstan-var array> */ public array $aliases = [ 'csrf' => CSRF::class, diff --git a/app/Views/errors/html/error_404.php b/app/Views/errors/html/error_404.php index c301013..e506f08 100644 --- a/app/Views/errors/html/error_404.php +++ b/app/Views/errors/html/error_404.php @@ -77,7 +77,7 @@ - +

diff --git a/app/Views/errors/html/error_exception.php b/app/Views/errors/html/error_exception.php index aad8126..a754a59 100644 --- a/app/Views/errors/html/error_exception.php +++ b/app/Views/errors/html/error_exception.php @@ -44,6 +44,7 @@ +
    @@ -66,7 +67,7 @@
  • - +

+