Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -26897,7 +26897,7 @@ <h3>Return</h3>
<h3>Declaration</h3>
<div class="method-declaratiopn"><span class="access-level">public</span> <span class="access-level">static</span> <span class="php-keyword">function</span> <span class="method-name">getInstance</span>(<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameter-type">string</span>|<span class="parameter-type">null</span> <span class="parameter-name">$name <span class="parameter-equal-sign">=</span> <span class="parameter-default">null</span></span>, <br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameter-type">int</span> <span class="parameter-name">$maxLifeTime <span class="parameter-equal-sign">=</span> <span class="parameter-default">0</span></span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameter-type">int</span> <span class="parameter-name">$maxLifetime <span class="parameter-equal-sign">=</span> <span class="parameter-default">0</span></span><br>
) : <span class="return-type">self</span><br>{<br>}</div>
<div class='docblock'>
<h3>Description</h3>
Expand All @@ -26907,7 +26907,7 @@ <h3>Description</h3>
<h3>Parameters</h3>
<div class="parameter-name">$name</div>
<div class="parameter-description"><p>Session name.</p></div>
<div class="parameter-name">$maxLifeTime</div>
<div class="parameter-name">$maxLifetime</div>
<div class="parameter-description"><p>Maximum lifetime of the session.</p></div>
<h3>Return</h3>
<div class="return-type">self</div>
Expand Down
2 changes: 1 addition & 1 deletion manual/includes/_environment-variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ database:
salt: ${APP_DATABASE_SALT}
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
vocal_guide_instrument: piano
```

Expand Down
4 changes: 2 additions & 2 deletions manual/includes/_secret-object.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ database:
salt: Asia/Jakarta
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: files
save_path: /tmp/session
vocal_guide_instrument: piano
Expand All @@ -495,7 +495,7 @@ database:
salt: hdsBgcmvq/rzfNUuhgQiBop4Hp4wqd5w03Il9zaOshK0LgGtaEK1WTcPx5OdL+9VvhmZvs7g/jDGYjYoHwXjIg==
session:
name: 4u5xAE2K74pUxZyIVsphoYUka3vpnzUx7op6CnELtdWNEepz/jQLaKynItFt5dx6bv7wjBUFL1AaZaA4ypw/CP6xtR5WFQy+RV6V8VqYM8o=
max_life_time: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
max_lifetime: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
save_handler: LIlCCaWHVqg9R4G6ghxDZnuenMLgSI6HjiW+tVGNDa7UyIA7FkFtOgOJtvT/EolUc+kkJSXiMo+76QhvFFq8Dg==
save_path: CZijzyucTzrj3tZ1M9PbQ6Hky1+4Gz3RnXwZNSe9/SL+9QZdpK4PoW2TSLsuQ+cKBgKgkncd7JXWgA3CFg0f1A==
result_per_page: 20
Expand Down
10 changes: 5 additions & 5 deletions manual/includes/_session.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Session variables keep information about one single user, and are available to a
```yaml
session:
name: ${SESSION_NAME}
max_life_time: ${SESSION_MAX_LIFE_TIME}
max_lifetime: ${SESSION_MAX_LIFE_TIME}
save_handler: ${SESSION_SAVE_HANDLER}
save_path: ${SESSION_SAVE_PATH}
cookie_lifetime: ${SESSION_COOKIE_LIFETIME}
Expand All @@ -23,7 +23,7 @@ session:

- **name**: Specifies the name of the session. The value `${SESSION_NAME}` refers to an environment variable or a parameter that should be defined elsewhere in the application or server environment. It determines the session's name identifier.

- **max_life_time**: Defines the maximum lifetime of the session in seconds. The value `${SESSION_MAX_LIFE_TIME}` is expected to come from an environment variable or configuration setting, controlling how long the session will last before it expires.
- **max_lifetime**: Defines the maximum lifetime of the session in seconds. The value `${SESSION_MAX_LIFE_TIME}` is expected to come from an environment variable or configuration setting, controlling how long the session will last before it expires.

- **save_handler**: Specifies the handler used to save session data. In this case, `${SESSION_SAVE_HANDLER}` likely refers to the session handler, such as `redis`, `files`, or `database`, depending on the server configuration.

Expand Down Expand Up @@ -66,7 +66,7 @@ $sessions->startSession();
```yaml
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: redis
save_path: tcp://127.0.0.1:6379?auth=myredispass
```
Expand All @@ -76,7 +76,7 @@ or
```yaml
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: redis
save_path: tcp://127.0.0.1:6379?auth=${REDIS_AUTH}
```
Expand All @@ -90,7 +90,7 @@ For example:
```yaml
session:
name: ${SESSION_NAME}
max_life_time: ${SESSION_MAX_LIFE_TIME}
max_lifetime: ${SESSION_MAX_LIFE_TIME}
save_handler: ${SESSION_SAVE_HANDLER}
save_path: ${SESSION_SAVE_PATH}
cookie_lifetime: ${SESSION_COOKIE_LIFETIME}
Expand Down
16 changes: 8 additions & 8 deletions manual/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ <h3>Create Yaml File</h3>
salt: ${APP_DATABASE_SALT}
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
vocal_guide_instrument: piano</code></pre>
<h3>Setting Up Environment Variables</h3>
<p>On Windows, users can directly create environment variables either via the graphical user interface (GUI) or the <code>setx</code> command line. PHP can immediately read environment variables after Windows is restarted.</p>
Expand Down Expand Up @@ -2591,7 +2591,7 @@ <h3>Multilevel Object Secure</h3>
salt: Asia/Jakarta
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: files
save_path: /tmp/session
vocal_guide_instrument: piano
Expand All @@ -2618,7 +2618,7 @@ <h3>Multilevel Object Secure</h3>
salt: hdsBgcmvq/rzfNUuhgQiBop4Hp4wqd5w03Il9zaOshK0LgGtaEK1WTcPx5OdL+9VvhmZvs7g/jDGYjYoHwXjIg==
session:
name: 4u5xAE2K74pUxZyIVsphoYUka3vpnzUx7op6CnELtdWNEepz/jQLaKynItFt5dx6bv7wjBUFL1AaZaA4ypw/CP6xtR5WFQy+RV6V8VqYM8o=
max_life_time: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
max_lifetime: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
save_handler: LIlCCaWHVqg9R4G6ghxDZnuenMLgSI6HjiW+tVGNDa7UyIA7FkFtOgOJtvT/EolUc+kkJSXiMo+76QhvFFq8Dg==
save_path: CZijzyucTzrj3tZ1M9PbQ6Hky1+4Gz3RnXwZNSe9/SL+9QZdpK4PoW2TSLsuQ+cKBgKgkncd7JXWgA3CFg0f1A==
result_per_page: 20
Expand Down Expand Up @@ -3470,7 +3470,7 @@ <h3>Session with File</h3>
<p><strong>Yaml File</strong></p>
<pre><code class="language-yaml">session:
name: ${SESSION_NAME}
max_life_time: ${SESSION_MAX_LIFE_TIME}
max_lifetime: ${SESSION_MAX_LIFE_TIME}
save_handler: ${SESSION_SAVE_HANDLER}
save_path: ${SESSION_SAVE_PATH}
cookie_lifetime: ${SESSION_COOKIE_LIFETIME}
Expand All @@ -3484,7 +3484,7 @@ <h3>Explanation:</h3>
<p><strong>name</strong>: Specifies the name of the session. The value <code>${SESSION_NAME}</code> refers to an environment variable or a parameter that should be defined elsewhere in the application or server environment. It determines the session's name identifier.</p>
</li>
<li>
<p><strong>max_life_time</strong>: Defines the maximum lifetime of the session in seconds. The value <code>${SESSION_MAX_LIFE_TIME}</code> is expected to come from an environment variable or configuration setting, controlling how long the session will last before it expires.</p>
<p><strong>max_lifetime</strong>: Defines the maximum lifetime of the session in seconds. The value <code>${SESSION_MAX_LIFE_TIME}</code> is expected to come from an environment variable or configuration setting, controlling how long the session will last before it expires.</p>
</li>
<li>
<p><strong>save_handler</strong>: Specifies the handler used to save session data. In this case, <code>${SESSION_SAVE_HANDLER}</code> likely refers to the session handler, such as <code>redis</code>, <code>files</code>, or <code>database</code>, depending on the server configuration.</p>
Expand Down Expand Up @@ -3527,21 +3527,21 @@ <h3>Session with Redis</h3>
<p><strong>Yaml File</strong></p>
<pre><code class="language-yaml">session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: redis
save_path: tcp://127.0.0.1:6379?auth=myredispass</code></pre>
<p>or</p>
<pre><code class="language-yaml">session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: redis
save_path: tcp://127.0.0.1:6379?auth=${REDIS_AUTH}</code></pre>
<p><strong>WARNING!</strong></p>
<p>You can not encrypt the <code>${REDIS_AUTH}</code> value. If you want to secure the config, encrypt entire <code>save_path</code> instead.</p>
<p>For example:</p>
<pre><code class="language-yaml">session:
name: ${SESSION_NAME}
max_life_time: ${SESSION_MAX_LIFE_TIME}
max_lifetime: ${SESSION_MAX_LIFE_TIME}
save_handler: ${SESSION_SAVE_HANDLER}
save_path: ${SESSION_SAVE_PATH}
cookie_lifetime: ${SESSION_COOKIE_LIFETIME}
Expand Down
8 changes: 4 additions & 4 deletions src/Request/InputSessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ class InputSessions extends PicoSession
* This method ensures that only one instance of PicoSession is created (Singleton pattern).
*
* @param string|null $name Session name.
* @param int $maxLifeTime Maximum lifetime of the session.
* @param int $maxLifetime Maximum lifetime of the session.
* @return self The instance of PicoSession.
*/
public static function getInstance($name = null, $maxLifeTime = 0)
public static function getInstance($name = null, $maxLifetime = 0)
{
if (!isset(self::$_instance)) {
self::$_instance = new self;
if (isset($name)) {
self::$_instance->setSessionName($name);
}
if ($maxLifeTime > 0) {
self::$_instance->setSessionMaxLifeTime($maxLifeTime);
if ($maxLifetime > 0) {
self::$_instance->setSessionMaxLifetime($maxLifetime);
}
}
self::$_instance->startSession();
Expand Down
14 changes: 7 additions & 7 deletions src/Session/PicoSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function __construct($sessConf = null)
if ($sessConf->getName() != "") {
$this->setSessionName($sessConf->getName());
}
if ($sessConf->getMaxLifeTime() > 0) {
$this->setSessionMaxLifeTime($sessConf->getMaxLifeTime());
if ($sessConf->getMaxLifetime() > 0) {
$this->setSessionMaxLifetime($sessConf->getMaxLifetime());
}
if ($sessConf->getSaveHandler() == "redis") {
$redisParams = $this->getRedisParams($sessConf);
Expand Down Expand Up @@ -175,18 +175,18 @@ function ($matches) {
* This method ensures that only one instance of PicoSession is created (Singleton pattern).
*
* @param string|null $name Session name.
* @param int $maxLifeTime Maximum lifetime of the session.
* @param int $maxLifetime Maximum lifetime of the session.
* @return self The instance of PicoSession.
*/
public static function getInstance($name = null, $maxLifeTime = 0)
public static function getInstance($name = null, $maxLifetime = 0)
{
if (!isset(self::$_instance)) {
self::$_instance = new self;
if (isset($name)) {
self::$_instance->setSessionName($name);
}
if ($maxLifeTime > 0) {
self::$_instance->setSessionMaxLifeTime($maxLifeTime);
if ($maxLifetime > 0) {
self::$_instance->setSessionMaxLifetime($maxLifetime);
}
}
self::$_instance->startSession();
Expand Down Expand Up @@ -403,7 +403,7 @@ public function setSessionSavePath($path)
* @param int $lifeTime Maximum lifetime for the session in seconds.
* @return self Returns the current instance for method chaining.
*/
public function setSessionMaxLifeTime($lifeTime)
public function setSessionMaxLifetime($lifeTime)
{
ini_set("session.gc_maxlifetime", $lifeTime);
ini_set("session.cookie_lifetime", $lifeTime);
Expand Down
4 changes: 2 additions & 2 deletions tests/SecretObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ConfigSecret2 extends SecretObject
salt: Asia/Jakarta
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: files
save_path: /tmp/session
vocal_guide_instrument: piano
Expand Down Expand Up @@ -115,7 +115,7 @@ class ConfigSecret2 extends SecretObject
salt: hdsBgcmvq/rzfNUuhgQiBop4Hp4wqd5w03Il9zaOshK0LgGtaEK1WTcPx5OdL+9VvhmZvs7g/jDGYjYoHwXjIg==
session:
name: 4u5xAE2K74pUxZyIVsphoYUka3vpnzUx7op6CnELtdWNEepz/jQLaKynItFt5dx6bv7wjBUFL1AaZaA4ypw/CP6xtR5WFQy+RV6V8VqYM8o=
max_life_time: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
max_lifetime: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
save_handler: LIlCCaWHVqg9R4G6ghxDZnuenMLgSI6HjiW+tVGNDa7UyIA7FkFtOgOJtvT/EolUc+kkJSXiMo+76QhvFFq8Dg==
save_path: CZijzyucTzrj3tZ1M9PbQ6Hky1+4Gz3RnXwZNSe9/SL+9QZdpK4PoW2TSLsuQ+cKBgKgkncd7JXWgA3CFg0f1A==
result_per_page: 20
Expand Down
16 changes: 8 additions & 8 deletions tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ database:
salt: ${APP_DATABASE_SALT}
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
vocal_guide_instrument: piano
```

Expand Down Expand Up @@ -2827,7 +2827,7 @@ database:
salt: Asia/Jakarta
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: files
save_path: /tmp/session
vocal_guide_instrument: piano
Expand All @@ -2854,7 +2854,7 @@ database:
salt: hdsBgcmvq/rzfNUuhgQiBop4Hp4wqd5w03Il9zaOshK0LgGtaEK1WTcPx5OdL+9VvhmZvs7g/jDGYjYoHwXjIg==
session:
name: 4u5xAE2K74pUxZyIVsphoYUka3vpnzUx7op6CnELtdWNEepz/jQLaKynItFt5dx6bv7wjBUFL1AaZaA4ypw/CP6xtR5WFQy+RV6V8VqYM8o=
max_life_time: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
max_lifetime: cspEenRp8+kwUY1RNvmEdWcLqmsRZ+UJZVjY4JwRsuIIfkr+J0w1SYCuRMzMtHG4/hZ5tlXhtGdRZyM7quCbZg==
save_handler: LIlCCaWHVqg9R4G6ghxDZnuenMLgSI6HjiW+tVGNDa7UyIA7FkFtOgOJtvT/EolUc+kkJSXiMo+76QhvFFq8Dg==
save_path: CZijzyucTzrj3tZ1M9PbQ6Hky1+4Gz3RnXwZNSe9/SL+9QZdpK4PoW2TSLsuQ+cKBgKgkncd7JXWgA3CFg0f1A==
result_per_page: 20
Expand Down Expand Up @@ -3808,7 +3808,7 @@ Session variables keep information about one single user, and are available to a
```yaml
session:
name: ${SESSION_NAME}
max_life_time: ${SESSION_MAX_LIFE_TIME}
max_lifetime: ${SESSION_MAX_LIFE_TIME}
save_handler: ${SESSION_SAVE_HANDLER}
save_path: ${SESSION_SAVE_PATH}
cookie_lifetime: ${SESSION_COOKIE_LIFETIME}
Expand All @@ -3822,7 +3822,7 @@ session:

- **name**: Specifies the name of the session. The value `${SESSION_NAME}` refers to an environment variable or a parameter that should be defined elsewhere in the application or server environment. It determines the session's name identifier.

- **max_life_time**: Defines the maximum lifetime of the session in seconds. The value `${SESSION_MAX_LIFE_TIME}` is expected to come from an environment variable or configuration setting, controlling how long the session will last before it expires.
- **max_lifetime**: Defines the maximum lifetime of the session in seconds. The value `${SESSION_MAX_LIFE_TIME}` is expected to come from an environment variable or configuration setting, controlling how long the session will last before it expires.

- **save_handler**: Specifies the handler used to save session data. In this case, `${SESSION_SAVE_HANDLER}` likely refers to the session handler, such as `redis`, `files`, or `database`, depending on the server configuration.

Expand Down Expand Up @@ -3865,7 +3865,7 @@ $sessions->startSession();
```yaml
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: redis
save_path: tcp://127.0.0.1:6379?auth=myredispass
```
Expand All @@ -3875,7 +3875,7 @@ or
```yaml
session:
name: MUSICPRODUCTIONMANAGER
max_life_time: 86400
max_lifetime: 86400
save_handler: redis
save_path: tcp://127.0.0.1:6379?auth=${REDIS_AUTH}
```
Expand All @@ -3889,7 +3889,7 @@ For example:
```yaml
session:
name: ${SESSION_NAME}
max_life_time: ${SESSION_MAX_LIFE_TIME}
max_lifetime: ${SESSION_MAX_LIFE_TIME}
save_handler: ${SESSION_SAVE_HANDLER}
save_path: ${SESSION_SAVE_PATH}
cookie_lifetime: ${SESSION_COOKIE_LIFETIME}
Expand Down