-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- creates SessionFactory - updates README.md - other improvements
- Loading branch information
Showing
4 changed files
with
173 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
{ | ||
"name": "kattsoftware/firesessions", | ||
"description": "PHP Sessions library", | ||
"minimum-stability": "stable", | ||
"description": "PHP Sessions management library", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "George Petculescu", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4.8" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"FireSessions\\": "src/FireSessions/" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace FireSessions; | ||
|
||
/** | ||
* Session static instance factory | ||
* | ||
* This content is released under the MIT License (MIT). | ||
* @see LICENSE file | ||
*/ | ||
class SessionFactory | ||
{ | ||
/** | ||
* @var Session Library static instance | ||
*/ | ||
private static $instance; | ||
|
||
/** | ||
* Creates (if doesn't exist) a static instance of the Session client. | ||
* Next calls can fetch this instance, without creating other ones. | ||
* | ||
* @param array $config Library config | ||
* @return Session Library instance | ||
*/ | ||
public static function getInstance(array $config = null) | ||
{ | ||
if (self::$instance === null) { | ||
return self::$instance = new Session($config); | ||
} | ||
|
||
return self::$instance; | ||
} | ||
} |