{"id":16339038,"url":"https://github.com/phadej/igbinary","last_synced_at":"2025-04-09T13:06:54.454Z","repository":{"id":527213,"uuid":"155943","full_name":"phadej/igbinary","owner":"phadej","description":"Igbinary is a drop in replacement for the standard php serializer.  Check https://github.com/igbinary/igbinary for the freshest version","archived":false,"fork":false,"pushed_at":"2014-08-29T09:00:12.000Z","size":699,"stargazers_count":260,"open_issues_count":3,"forks_count":93,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-02T11:07:08.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phadej.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-03-21T19:53:57.000Z","updated_at":"2025-03-10T22:49:17.000Z","dependencies_parsed_at":"2022-07-07T22:04:53.422Z","dependency_job_id":null,"html_url":"https://github.com/phadej/igbinary","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Figbinary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Figbinary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Figbinary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Figbinary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phadej","download_url":"https://codeload.github.com/phadej/igbinary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045231,"owners_count":21038553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T23:53:22.339Z","updated_at":"2025-04-09T13:06:54.428Z","avatar_url":"https://github.com/phadej.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"igbinary\n========\n\n[![Build Status](https://travis-ci.org/igbinary/igbinary.svg?branch=master)](https://travis-ci.org/igbinary/igbinary)\n\nIgbinary is a drop in replacement for the standard php serializer. Instead of\ntime and space consuming textual representation, igbinary stores php data\nstructures in compact binary form. Savings are significant when using\nmemcached or similar memory based storages for serialized data. About 50%\nreduction in storage requirement can be expected. Specific number depends on\nyour data.\n\nUnserialization performance is at least on par with the standard PHP serializer.\nSerialization performance depends on the \"compact_strings\" option which enables\nduplicate string tracking. String are inserted to a hash table which adds some\noverhead. In usual scenarios this does not have much significance since usage\npattern is \"serialize rarely, unserialize often\". With \"compact_strings\"\noption igbinary is usually a bit slower than the standard serializer. Without\nit, a bit faster.\n\nFeatures\n--------\n\n- Supports same data types as the standard PHP serializer: null, bool, int,\n  float, string, array and objects.\n- `__autoload` \u0026 `unserialize_callback_func`\n- `__sleep` \u0026 `__wakeup`\n- Serializable -interface\n- Data portability between platforms (32/64bit, endianess)\n- Tested on Linux amd64, Linux ARM, Mac OSX x86, HP-UX PA-RISC and NetBSD sparc64\n- Hooks up to APC opcode cache as a serialization handler (APC 3.1.7+)\n- Compatible with PHP 5.2 \u0026ndash; 5.6\n\nImplementation details\n----------------------\n\nStoring complex PHP data structures like arrays of associative arrays\nwith the standard PHP serializer is not very space efficient. The main\nreasons in order of significance are (at least in our applications):\n\n1. Array keys are repeated redundantly.\n2. Numerical values are plain text.\n3. Human readability adds some overhead.\n\nIgbinary uses two specific strategies to minimize the size of the serialized\noutput.\n\n1. Repetitive strings are stored only once. Collections of objects benefit\n   significantly from this. See \"compact_strings\" option.\n\n2. Numerical values are stored in the smallest primitive data type\n   available:\n    *123* = `int8_t`,\n    *1234* = `int16_t`,\n    *123456* = `int32_t`\n ... and so on.\n\n3. ( Well, it is not human readable ;)\n\nHow to use\n----------\n\nAdd the following lines to your php.ini:\n\n    ; Load igbinary extension\n    extension=igbinary.so\n\n    ; Use igbinary as session serializer\n    session.serialize_handler=igbinary\n\n    ; Enable or disable compacting of duplicate strings\n    ; The default is On.\n    igbinary.compact_strings=On\n\n    ; Use igbinary as serializer in APC cache (3.1.7 or later)\n    ;apc.serializer=igbinary\n\n.. and in your php code replace serialize and unserialize function calls\nwith `igbinary_serialize` and `igbinary_unserialize`.\n\nInstalling\n----------\n\nNote:\nSometimes phpize must be substituted with phpize5. In such cases the following\noption must be given to configure script: \"--with-php-config=.../php-config5\"\n\n1. `phpize`\n2. `./configure:\n    - With GCC: `./configure CFLAGS=\"-O2 -g\" --enable-igbinary`\n    - With ICC (Intel C Compiler) `./configure CFLAGS=\" -no-prec-div -O3 -xO -unroll2 -g\" CC=icc --enable-igbinary`\n    - With clang: `./configure CC=clang CFLAGS=\"-O0 -g\" --enable-igbinary`\n3. `make`\n4. `make test`\n5. `make install`\n6. igbinary.so is installed to the default extension directory\n\n### To run APCu test\n\n```\n# go to modules directory\ncd modules\n\n# ... and create symlink to apcu extension\n# it will be loaded during test suite\n/opt/lib/php/extensions/no-debug-non-zts-20121212/apcu.so\n```\n\nSimilar approach should work for APC.\n\nBugs \u0026 Contributions\n--------------------\n\nMailing list for bug reports and other development discussion can be found\nat http://groups.google.com/group/igbinary\n\nFill bug reports at\nhttps://github.com/igbinary/igbinary/issues\n\nThe preferred ways for contributions are pull requests and email patches\n(in git format). Feel free to fork at http://github.com/igbinary/igbinary\n\nUtilizing in other extensions\n-----------------------------\n\nIgbinary can be called from other extensions fairly easily. Igbinary installs\nits header file to _ext/igbinary/igbinary.h_. There are just two straighforward\nfunctions: `igbinary_serialize` and `igbinary_unserialize`. Look at _igbinary.h_ for\nprototypes and usage.\n\nAdd `PHP_ADD_EXTENSION_DEP(yourextension, igbinary)` to your _config.m4_ in case\nsomeone wants to compile both of them statically into php.\n\nTrivia\n------\n\nWhere does the name \"igbinary\" come from? There was once a similar project\ncalled fbinary but it has disappeared from the Internet a long time ago. Its\narchitecture wasn't particularly clean either. IG is an abbreviation for a\nfinnish social networking site IRC-Galleria (http://irc-galleria.net/)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Figbinary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphadej%2Figbinary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Figbinary/lists"}