Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jqr/php-serialize
Use PHP's serialization methods from Ruby.
https://github.com/jqr/php-serialize
php ruby serialization session sessionstorage
Last synced: 8 days ago
JSON representation
Use PHP's serialization methods from Ruby.
- Host: GitHub
- URL: https://github.com/jqr/php-serialize
- Owner: jqr
- License: mit
- Created: 2009-06-19T01:38:56.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2024-03-04T15:56:28.000Z (8 months ago)
- Last Synced: 2024-10-20T07:43:08.975Z (19 days ago)
- Topics: php, ruby, serialization, session, sessionstorage
- Language: Ruby
- Homepage:
- Size: 79.1 KB
- Stars: 127
- Watchers: 6
- Forks: 55
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`:
```ruby
gem "php-serialize"
```## Usage
```ruby
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 , http://hur.st/