File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
# XSession
6
6
An OO-PHP class to easily handle sessions
7
+
8
+ ## Usage
9
+ Include or autoload the XSession.php file, then use as follows..
10
+
11
+ ``` php
12
+ use solutionstack\XSession
13
+ //create A session
14
+ $s = new XSession(string session_name, int session_lifetime_in_secs);
15
+ //add session data as needed
16
+ $s->put("foo", "bar"):
17
+ $->put("user_email", "
[email protected] ");
18
+
19
+ ```
20
+ ## In other pages u need to use (check/resume) the session, just do..
21
+
22
+ ``` php
23
+ //use the same session name used in starting the session
24
+ $s = new XSession(string session_name);
25
+ if($s->resume()) { //session was succesfully resumed
26
+ //do stuff for authenticated users
27
+ //also get previously set session values, or set new one
28
+ $email = $s->get("user_email");
29
+ }
30
+
31
+ ```
32
+ ## When done with the session, say in your logout routine,..
33
+
34
+ ``` php
35
+ //use the same session name used in starting the session
36
+ $s = new XSession(string session_name);
37
+ $s->end();
38
+ }
39
+
40
+ ```
41
+ ### And Thats it.
42
+
43
+ ### XSession uses ideas from the following project [ SecureSessionHandler]
44
+ See https://gist.github.com/eddmann/10262795
45
+
46
+ License
47
+ ----
48
+
49
+ MIT
50
+
51
+
52
+ ** Free Software, Hell Yeah!**
53
+
You can’t perform that action at this time.
0 commit comments