Skip to content

Instantly share code, notes, and snippets.

@jinkrish
Created June 1, 2016 11:46
Show Gist options
  • Save jinkrish/0f1f1d8e58e2749b1c1447c365e0c3d7 to your computer and use it in GitHub Desktop.
Save jinkrish/0f1f1d8e58e2749b1c1447c365e0c3d7 to your computer and use it in GitHub Desktop.
<?php
interface sessionStorage{
public function get($key);
public function set($key,$value);
}
class fileSessionStorage implements sessionStorage {
public function get($key){
...
}
public function set($key,$value){
...
}
}
class mysqlSessionStorage implements sessionStorage {
public function get($key){
...
}
public function set($key,$value){
...
}
}
class userClass {
protected $session;
public function __construct(sessionStorage $session){
$this->session = $session;
}
}
App::bind('sessionStorage','mysqlSessionStorage');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment