PHP session encoder/decoder written in Go
Switch branches/tags
Nothing to show
Clone or download
yvasiyarov Merge pull request #21 from xuzhou027/master
delete unserialize.go 267 err
Latest commit a065a3b Aug 3, 2018


PHP session encoder/decoder written in Go
Build Status



  • The recommended way to install is using

    nut get yvasiyarov/php_session_decoder for more information, please, go to the

  • Using default go get tool:

    go get

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


2013-2014 Yuriy Vasiyarov
2014 Yuriy Vasiyarov, Maksim Naumov.

All rights reserved.