Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yvasiyarov/php_session_decoder
PHP session encoder/decoder written in Go
https://github.com/yvasiyarov/php_session_decoder
Last synced: about 2 months ago
JSON representation
PHP session encoder/decoder written in Go
- Host: GitHub
- URL: https://github.com/yvasiyarov/php_session_decoder
- Owner: yvasiyarov
- License: bsd-2-clause
- Created: 2012-12-23T14:04:25.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-11-02T07:23:13.000Z (about 6 years ago)
- Last Synced: 2024-07-31T20:52:53.500Z (4 months ago)
- Language: Go
- Size: 89.8 KB
- Stars: 161
- Watchers: 10
- Forks: 45
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - php_session_decoder - GoLang library for working with PHP session format and PHP Serialize/Unserialize functions. (Serialization / HTTP Clients)
- zero-alloc-awesome-go - php_session_decoder - GoLang library for working with PHP session format and PHP Serialize/Unserialize functions. (Serialization / HTTP Clients)
- awesome-go - php_session_decoder - PHP session encoder/decoder written in Go - ★ 101 (Serialization)
- awesome-go-extra - php_session_decoder - 12-23T14:04:25Z|2018-11-02T07:23:13Z| (Serialization / HTTP Clients)
- awesome-go-zh - php_session_decoder
README
php_session_decoder
===================PHP session encoder/decoder written in Go
[![Build Status](https://secure.travis-ci.org/yvasiyarov/php_session_decoder.png?branch=master)](http://travis-ci.org/yvasiyarov/php_session_decoder)Installation
------------Install:
- ~~The recommended way~~ to install is using gonuts.io:
nut get yvasiyarov/php_session_decoder
for more information, please, go to the http://www.gonuts.io/yvasiyarov/php_session_decoder- Using default go get tool:
go get github.com/yvasiyarov/php_session_decoder
Getting started
---------------Example: load php session data from redis:
if sessionId, err := req.Cookie("frontend"); err == nil {
if sessionData, err := redis.Get("PHPREDIS_SESSION:" + sessionId.Value); err == nil {
decoder := php_session_decoder.NewPhpDecoder(sessionData.String())
if sessionDataDecoded, err := decoder.Decode(); err == nil {
//Do something with session data
}
} else {
//Can not load session - it can be expired
}
}Example: Encode php session data:
data := make(PhpSession)
data["make some"] = " changes"
encoder := NewPhpEncoder(data)
if result, err := encoder.Encode(); err == nil {
//Write data to redis/memcached/file/etc
}Copyright
----------------------------
2013-2014 Yuriy Vasiyarov
2014 Yuriy Vasiyarov, Maksim Naumov.All rights reserved.