h4kuna / serialize-polyfill
Provide methods for serialization and use igbinary if is available.
Installs: 15 212
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- nette/utils: >= 3.0
Requires (Dev)
- nette/tester: ^2.4
- phpstan/phpstan: ^1.9
- tracy/tracy: ^2.9
Suggests
- php: >=7.4
- ext-igbinary: to use efficient serialization
- ext-mbstring: for check errors by igbinary
README
In your project are available two new methods.
- h4kuna\Serialize\Serialize::encode()
- h4kuna\Serialize\Serialize::decode()
If you enable igbinary extension, then automatic use Driver\IgBinary. Or you can define own implmentation by Driver interface.
Compatibility
You are using php serialize and you want to use igbinary. You can enable igbinaty on fly and old serialized data will be decoded by old php serialize.
Support compatibility, if you have serialized data by php serialize, then you can decode by IgBinary::decode() and vice versa.
Enable custom driver
Register you driver after autoload. By default, you can skip this step.
require __DIR__ . '/vendor/autoload.php'; \h4kuna\Serialize\Serialize::setUp(Php::class);
Enable igbinary
- Install igbinary extension
Works!
Disable igbinary
- set Php driver after vendor/autoload.php
require __DIR__ . '/vendor/autoload.php'; \h4kuna\Serialize\Serialize::setUp(Php::class);
- wait if your all data will be decoded
- uninstall igbinary extension