Skip to content

Phalcon PHP - Database Session adapter using a Model written in PHP

License

Notifications You must be signed in to change notification settings

mattrmiller/phalcon-dbsessionadapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

phalconphp-dbsessionadapter

Phalcon PHP - Database Session adapter using a Model.

Installation

  1. Copy Code into Respective Folders
  • /app/Library/*
  • /app/Models/*
  1. Database Table
CREATE TABLE `sessions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(64) NOT NULL DEFAULT '',
  `data` longtext NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `modified_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `created_at` (`created_at`),
  KEY `modified_at` (`modified_at`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
  1. Setup Service
$di->set('session', function () use ($oConfig) {

		// Sessions
		return new DbSessionAdapter(array(
			'name' => 'myawesomeapplication',
			'domain' => 'myawesomeapplication.com',
			'secure' => 1,
			'use_cookies' => 1,
			'hash' => 'sha256',
			'lifetime' => 0
		));

	});
  1. Use Like Regular Phalcon Sessions
$this->session->set('enjoy_our_code', 'ok');

Rules For Contributing

  • Please make sure all changed files are run through gofmt
  • Submit a PR for review
  • Your name will be added below to Contributors

Author

Matthew R. Miller

Contributors

Matthew R. Miller

License

MIT License

About

Phalcon PHP - Database Session adapter using a Model written in PHP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages