• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 15 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Use PHP's serialization methods from Ruby.

Ruby PHP Serializer

This module provides two methods: PHP.serialize and PHP.unserialize, both of which should be compatible with the similarly named functions in PHP.

Installing

In your Gemfile:

gem "php-serialize"

Usage

PHP.serialize({'foo' => 'bar'})               #=> "a:1:{s:3:\"foo\";s:3:\"bar\";}"
PHP.unserialize('a:1:{s:3:"foo";s:3:"bar";}') #=> {"foo"=>"bar"}

PHP.unserialize can also read PHP sessions, which are collections of named serialized objects. These can be reserialized using PHP.serialize_session, which has the same semantics as PHP.serialize, but which only supports Hash and associative Arrays for the root object.

See http://php.net/serialize and http://php.net/unserialize for details on the PHP side of all this.

Acknowledgements

  • TJ Vanderpoel, initial PHP serialized session support.
  • Philip Hallstrom, fix for self-generated Structs on unserialization.
  • Edward Speyer, fix for assoc serialization in nested structures.

Author: Thomas Hurst [email protected], http://hur.st/

More Repositories

1

heroku_san

Helpful stuffs for Heroku.
Ruby
584
star
2

dotfiles

Super bad-ass dotfiles for any Ruby/Rails/Git/OSX user.
Shell
58
star
3

achievement_maker

Generate your own achievements
Ruby
48
star
4

jqr.github.io

My jekyll based blog
JavaScript
24
star
5

typed_serialize

Typed serialize makes sure your serialized attribute is always the specified type.
Ruby
19
star
6

simple_column_search

Quick and dirty multi column LIKE searches.
Ruby
17
star
7

has_one_autocreate

A Rails plugin for automatic creation and building for has_one relationships
Ruby
16
star
8

easyjour

Super simple access to service announcing and discovery using Bonjour aka DNSSD.
Ruby
11
star
9

centipede

A clone of the the popular Centipede arcade game, produced at Indy.rb's first gosu hackfest.
Ruby
10
star
10

static_pages

Provides an area to store your static pages that still need to be rendered with the application layout.
Ruby
8
star
11

negative_named_scope

A Rails plugin to automatically generate the NOT'd version of your named scope.
Ruby
6
star
12

usernamecheck

Checks username availability on many populer sites.
Ruby
6
star
13

postgres_sequence_support

Support for manipulating PostgreSQL sequences from ActiveRecord.
Ruby
5
star
14

super_range

Support for open ended ranges in Ruby.
Ruby
5
star
15

air_speakers

A simple interface to Airport Express speakers using Net::RAOP::Client
Ruby
5
star
16

tower

A simple Tower Defense game written in Ruby with Gosu.
Ruby
5
star
17

lolcodr

An exploration of Treetop via a simple LOLCode interpreter.
Ruby
5
star
18

stale_object_destroyer

An easy way to handle stale object errors in Rails by retrying the entire request.
Ruby
4
star
19

dnssd

C
4
star
20

versionable

Simple versioning for Ruby objects using only the Rails cache.
Ruby
3
star
21

hyrarchy

Gem and Rails plugin for working with hierarchic data in ActiveRecord
Ruby
3
star
22

log_methods

Log methods shows you exactly what arguments a method was called with and what it returned.
2
star
23

thor_tasks

2
star
24

github_playground

Scripts and such to play with github.
Ruby
2
star
25

vimtips

A Merb app for inputting Vim tips that are <= 140 characters, for posting to Twitter.
Ruby
1
star
26

processing_playground

Just some hacks related to the Processing language.
1
star
27

elixir-playground

Elixir
1
star
28

status

Ruby
1
star