-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1eeeab4
Showing
9 changed files
with
405 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor/ | ||
composer.lock |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 Eric Mann <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,2 @@ | ||
PHP Sessionz | ||
============ |
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,20 @@ | ||
{ | ||
"name": "ericmann/sessionz", | ||
"description": "PHP Session Manager Interface", | ||
"type": "library", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Eric Mann", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=5.6.28" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^5.6" | ||
} | ||
} |
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,65 @@ | ||
<?php | ||
namespace EAMann\Sessionz; | ||
|
||
abstract class Handler { | ||
/** | ||
* Action to be run when closing the current session. | ||
* | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
abstract public function close($next); | ||
|
||
/** | ||
* Action to be run when destroying a session based on its ID. | ||
* | ||
* @param string $id | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
abstract public function destroy($id, $next); | ||
|
||
/** | ||
* Action to be run when cleaning up expired sessions. | ||
* | ||
* @param int $maxlifetime | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
abstract public function gc($maxlifetime, $next); | ||
|
||
/** | ||
* Action to be run when creating a new session. | ||
* | ||
* @param string $path | ||
* @param string $name | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
abstract public function open($path, $name, $next); | ||
|
||
/** | ||
* Action to be run when reading session data from storage. | ||
* | ||
* @param string $id | ||
* @param callable $next | ||
* | ||
* @return string | ||
*/ | ||
abstract public function read($id, $next); | ||
|
||
/** | ||
* Action to be run when writing session data to storage. | ||
* | ||
* @param string $id | ||
* @param string $data | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
abstract public function write($id, $data, $next); | ||
} |
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,69 @@ | ||
<?php | ||
namespace EAMann\Sessionz\Handlers; | ||
|
||
use EAMann\Sessionz\Handler; | ||
|
||
class MemcacheHandler extends Handler { | ||
|
||
/** | ||
* Noop function for closing a session. | ||
* | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
public function close($next) | ||
{ | ||
return $next(); | ||
} | ||
|
||
/** | ||
* Noop function for destroying a session. | ||
* | ||
* @param string $id | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
public function destroy($id, $next) | ||
{ | ||
return $next( $id ); | ||
} | ||
|
||
/** | ||
* Noop function for cleaning up expired sessions. | ||
* | ||
* @param int $maxlifetime | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
public function gc($maxlifetime, $next) | ||
{ | ||
return $next( $maxlifetime ); | ||
} | ||
|
||
/** | ||
* Noop function for creating a session. | ||
* | ||
* @param string $path | ||
* @param string $name | ||
* @param callable $next | ||
* | ||
* @return bool | ||
*/ | ||
public function open($path, $name, $next) | ||
{ | ||
return $next( $path, $name ); | ||
} | ||
|
||
public function read($id, $next) | ||
{ | ||
// TODO: Implement read() method. | ||
} | ||
|
||
public function write($id, $data, $next) | ||
{ | ||
// TODO: Implement write() method. | ||
} | ||
} |
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,68 @@ | ||
<?php | ||
namespace EAMann\Sessionz\Handlers; | ||
|
||
use EAMann\Sessionz\Handler; | ||
|
||
class MemcacheHandler extends Handler { | ||
|
||
/** | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function close($next) | ||
{ | ||
// TODO: Implement close() method. | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function destroy($id, $next) | ||
{ | ||
// TODO: Implement destroy() method. | ||
} | ||
|
||
/** | ||
* @param int $maxlifetime | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function gc($maxlifetime, $next) | ||
{ | ||
// TODO: Implement gc() method. | ||
} | ||
|
||
/** | ||
* @param string $path | ||
* @param string $name | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function open($path, $name, $next) | ||
{ | ||
// TODO: Implement open() method. | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function read($id, $next) | ||
{ | ||
// TODO: Implement read() method. | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @param string $data | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function write($id, $data, $next) | ||
{ | ||
// TODO: Implement write() method. | ||
} | ||
} |
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,68 @@ | ||
<?php | ||
namespace EAMann\Sessionz\Handlers; | ||
|
||
use EAMann\Sessionz\Handler; | ||
|
||
class MemoryHandler extends Handler { | ||
|
||
/** | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function close($next) | ||
{ | ||
// TODO: Implement close() method. | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function destroy($id, $next) | ||
{ | ||
// TODO: Implement destroy() method. | ||
} | ||
|
||
/** | ||
* @param int $maxlifetime | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function gc($maxlifetime, $next) | ||
{ | ||
// TODO: Implement gc() method. | ||
} | ||
|
||
/** | ||
* @param string $path | ||
* @param string $name | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function open($path, $name, $next) | ||
{ | ||
// TODO: Implement open() method. | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function read($id, $next) | ||
{ | ||
// TODO: Implement read() method. | ||
} | ||
|
||
/** | ||
* @param string $id | ||
* @param string $data | ||
* @param callable $next | ||
* @return mixed | ||
*/ | ||
public function write($id, $data, $next) | ||
{ | ||
// TODO: Implement write() method. | ||
} | ||
} |
Oops, something went wrong.