{"id":19692351,"url":"https://github.com/ddrv/php-extra-pack","last_synced_at":"2025-02-27T09:52:10.097Z","repository":{"id":56964306,"uuid":"119069349","full_name":"ddrv/php-extra-pack","owner":"ddrv","description":"extras for pack and unpack functions","archived":false,"fork":false,"pushed_at":"2018-12-20T05:28:11.000Z","size":20,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-10T08:58:42.052Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddrv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-26T15:37:53.000Z","updated_at":"2020-04-23T16:52:34.000Z","dependencies_parsed_at":"2022-08-21T05:30:14.499Z","dependency_job_id":null,"html_url":"https://github.com/ddrv/php-extra-pack","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/ddrv%2Fphp-extra-pack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddrv%2Fphp-extra-pack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddrv%2Fphp-extra-pack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddrv%2Fphp-extra-pack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddrv","download_url":"https://codeload.github.com/ddrv/php-extra-pack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241001200,"owners_count":19891949,"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-11-11T19:13:03.920Z","updated_at":"2025-02-27T09:52:10.050Z","avatar_url":"https://github.com/ddrv.png","language":"PHP","readme":"[![Packagist](https://img.shields.io/packagist/v/ddrv/extra-pack.svg?style=flat-square)](https://packagist.org/packages/ddrv/extra-pack)\n[![Downloads](https://img.shields.io/packagist/dt/ddrv/extra-pack.svg?style=flat-square)](https://packagist.org/packages/ddrv/extra-pack/stats)\n[![License](https://img.shields.io/packagist/l/ddrv/extra-pack.svg?style=flat-square)](https://github.com/ddrv/extra-pack/blob/master/LICENSE)\n[![PHP](https://img.shields.io/packagist/php-v/ddrv/extra-pack.svg?style=flat-square)](https://php.net)\n\n# ExtraPack\n\n\u003e Extras for pack() and unpack() functions.\n\n# Install\n\n```text\ncomposer require ddrv/extra-pack\n```\n\n```php\n\u003c?php\nrequire ('vendor/autoload.php');\n```\n\n# Usage\n\n```php\n\u003c?php\n$data = array(\n    'key1' =\u003e 'string',\n    'key2' =\u003e 5,\n    'key3' =\u003e .0001\n);\n$format = 'A6key1/Ckey2/t4key3';\n$binary = \\Ddrv\\Extra\\Pack::pack($format, $data);\n$result = \\Ddrv\\Extra\\Pack::unpack($format, $binary);\nprint_r($result);\n```\n\n```text\nArray\n(\n    [key1] =\u003e string\n    [key2] =\u003e 5\n    [key3] =\u003e .0001\n)\n```\n\n# Format\n\n```text\ncharacter[+number]+key[+:added]\n```\n\nElements are separated by a slash\n\nExamples:\n\n|Format|Key|Result|\n|---|---|---|\n|A6name|name|string with length 6|\n|Coffset:2000|offset|Number from 0 to 255 + 2000|\n\n\n# Format characters\n\nCurrently implemented formats are:\n\n|Character|Is extras|Description|Support from PHP version|Number|Added|\n|---|---|---|---|---|---|\n|@|No|NUL-fill to absolute position|5.0|Position|No using|\n|~|Yes|NUL-ended string|5.0|No using|No using|\n|Z|No|NUL-padded string|5.5.0|Length of string|No using|\n|x|No|NUL byte|5.0|Count iterations|No using|\n|X|No|Back up one byte|5.0|Length of reserved string|No using|\n|a|No|NUL-padded string|5.0|Length of string `may be *`|No using|\n|A|No|SPACE-padded string|5.0|Length of string `may be *`|No using|\n|h|No|Hex string, low nibble first|5.0|No using|No using|\n|H|No|Hex string, high nibble first|5.0|No using|No using|\n|c|No|signed char|5.0|No using|Added number|\n|C|No|unsigned char|5.0|No using|Added number|\n|s|No|signed short (always 16 bit, machine byte order)|5.0|No using|Added number|\n|S|No|unsigned short (always 16 bit, machine byte order)|5.0|No using|Added number|\n|n|No|unsigned short (always 16 bit, big endian byte order)|5.0|No using|Added number|\n|v|No|unsigned short (always 16 bit, little endian byte order)|5.0|No using|Added number|\n|m|Yes|signed medium (always 24 bit, machine byte order)|5.0|No using|Added number|\n|M|Yes|unsigned medium (always 24 bit, machine byte order)|5.0|No using|Added number|\n|l|No|signed long (always 32 bit, machine byte order)|5.0|No using|Added number|\n|L|No|unsigned long (always 32 bit, machine byte order)|5.0|No using|Added number|\n|N|No|unsigned long (always 32 bit, big endian byte order)|5.0|No using|Added number|\n|V|No|unsigned long (always 32 bit, little endian byte order)|5.0|No using|Added number|\n|q|No|signed long long (always 64 bit, machine byte order)|5.6.3|No using|Added number|\n|Q|No|unsigned long long (always 64 bit, machine byte order)|5.6.3|No using|Added number|\n|J|No|unsigned long long (always 64 bit, big endian byte order)|5.6.3|No using|Added number|\n|P|No|unsigned long long (always 64 bit, little endian byte order)|5.6.3|No using|Added number|\n|i|No|signed integer (machine dependent size and byte order)|5.0|No using|Added number|\n|I|No|unsigned integer (machine dependent size and byte order)|5.0|No using|Added number|\n|f|No|float (machine dependent size and representation)|5.0|No using|Added number|\n|g|No|float (machine dependent size, little endian byte order)|7.0.15, 7.1.1|No using|Added number|\n|G|No|float (machine dependent size, big endian byte order)|7.0.15, 7.1.1|No using|Added number|\n|d|No|double (machine dependent size and representation)|5.0|No using|Added number|\n|e|No|double (machine dependent size, little endian byte order)|7.0.15, 7.1.1|No using|Added number|\n|E|No|double (machine dependent size, big endian byte order)|7.0.15, 7.1.1|No using|Added number|\n|t|Yes|signed tiny rounded (always 8 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n|T|Yes|unsigned tiny rounded (always 8 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n|o|Yes|signed short rounded (always 16 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n|O|Yes|unsigned short rounded (always 16 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n|r|Yes|signed medium rounded (always 24 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n|R|Yes|unsigned medium rounded (always 24 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n|b|Yes|signed big rounded (always 32 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n|B|Yes|unsigned big rounded (always 32 bit, machine byte order)|5.0|Number of digits after the decimal point|Added number|\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddrv%2Fphp-extra-pack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddrv%2Fphp-extra-pack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddrv%2Fphp-extra-pack/lists"}