|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Config; |
| 4 | + |
| 5 | +use CodeIgniter\Config\BaseConfig; |
| 6 | +use CodeIgniter\Session\Handlers\FileHandler; |
| 7 | +use SessionHandlerInterface; |
| 8 | + |
| 9 | +class Session extends BaseConfig |
| 10 | +{ |
| 11 | + /** |
| 12 | + * -------------------------------------------------------------------------- |
| 13 | + * Session Driver |
| 14 | + * -------------------------------------------------------------------------- |
| 15 | + * |
| 16 | + * The session storage driver to use: |
| 17 | + * - `CodeIgniter\Session\Handlers\FileHandler` |
| 18 | + * - `CodeIgniter\Session\Handlers\DatabaseHandler` |
| 19 | + * - `CodeIgniter\Session\Handlers\MemcachedHandler` |
| 20 | + * - `CodeIgniter\Session\Handlers\RedisHandler` |
| 21 | + * |
| 22 | + * @phpstan-var class-string<SessionHandlerInterface> |
| 23 | + */ |
| 24 | + public string $driver = FileHandler::class; |
| 25 | + |
| 26 | + /** |
| 27 | + * -------------------------------------------------------------------------- |
| 28 | + * Session Cookie Name |
| 29 | + * -------------------------------------------------------------------------- |
| 30 | + * |
| 31 | + * The session cookie name, must contain only [0-9a-z_-] characters |
| 32 | + */ |
| 33 | + public string $cookieName = 'ci_session'; |
| 34 | + |
| 35 | + /** |
| 36 | + * -------------------------------------------------------------------------- |
| 37 | + * Session Expiration |
| 38 | + * -------------------------------------------------------------------------- |
| 39 | + * |
| 40 | + * The number of SECONDS you want the session to last. |
| 41 | + * Setting to 0 (zero) means expire when the browser is closed. |
| 42 | + */ |
| 43 | + public int $expiration = 7200; |
| 44 | + |
| 45 | + /** |
| 46 | + * -------------------------------------------------------------------------- |
| 47 | + * Session Save Path |
| 48 | + * -------------------------------------------------------------------------- |
| 49 | + * |
| 50 | + * The location to save sessions to and is driver dependent. |
| 51 | + * |
| 52 | + * For the 'files' driver, it's a path to a writable directory. |
| 53 | + * WARNING: Only absolute paths are supported! |
| 54 | + * |
| 55 | + * For the 'database' driver, it's a table name. |
| 56 | + * Please read up the manual for the format with other session drivers. |
| 57 | + * |
| 58 | + * IMPORTANT: You are REQUIRED to set a valid save path! |
| 59 | + */ |
| 60 | + public string $savePath = WRITEPATH . 'session'; |
| 61 | + |
| 62 | + /** |
| 63 | + * -------------------------------------------------------------------------- |
| 64 | + * Session Match IP |
| 65 | + * -------------------------------------------------------------------------- |
| 66 | + * |
| 67 | + * Whether to match the user's IP address when reading the session data. |
| 68 | + * |
| 69 | + * WARNING: If you're using the database driver, don't forget to update |
| 70 | + * your session table's PRIMARY KEY when changing this setting. |
| 71 | + */ |
| 72 | + public bool $matchIP = false; |
| 73 | + |
| 74 | + /** |
| 75 | + * -------------------------------------------------------------------------- |
| 76 | + * Session Time to Update |
| 77 | + * -------------------------------------------------------------------------- |
| 78 | + * |
| 79 | + * How many seconds between CI regenerating the session ID. |
| 80 | + */ |
| 81 | + public int $timeToUpdate = 300; |
| 82 | + |
| 83 | + /** |
| 84 | + * -------------------------------------------------------------------------- |
| 85 | + * Session Regenerate Destroy |
| 86 | + * -------------------------------------------------------------------------- |
| 87 | + * |
| 88 | + * Whether to destroy session data associated with the old session ID |
| 89 | + * when auto-regenerating the session ID. When set to FALSE, the data |
| 90 | + * will be later deleted by the garbage collector. |
| 91 | + */ |
| 92 | + public bool $regenerateDestroy = false; |
| 93 | + |
| 94 | + /** |
| 95 | + * -------------------------------------------------------------------------- |
| 96 | + * Session Database Group |
| 97 | + * -------------------------------------------------------------------------- |
| 98 | + * |
| 99 | + * DB Group for the database session. |
| 100 | + */ |
| 101 | + public ?string $DBGroup = null; |
| 102 | +} |
0 commit comments