{"id":42107267,"url":"https://github.com/carloshenrq/php-grf","last_synced_at":"2026-01-26T13:20:03.759Z","repository":{"id":62499704,"uuid":"172561525","full_name":"carloshenrq/php-grf","owner":"carloshenrq","description":"This is a lib to allow PHP to read and write GRF (Gravity Ragnarok Files).","archived":false,"fork":false,"pushed_at":"2019-06-21T00:55:43.000Z","size":1010,"stargazers_count":17,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-17T22:29:07.641Z","etag":null,"topics":["gravity-ragnarok-file","grf","php","php-grf","ragnarok","ragnarokonline"],"latest_commit_sha":null,"homepage":"","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/carloshenrq.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":"2019-02-25T18:30:10.000Z","updated_at":"2025-01-27T20:59:28.000Z","dependencies_parsed_at":"2022-11-02T10:00:56.610Z","dependency_job_id":null,"html_url":"https://github.com/carloshenrq/php-grf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/carloshenrq/php-grf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloshenrq%2Fphp-grf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloshenrq%2Fphp-grf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloshenrq%2Fphp-grf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloshenrq%2Fphp-grf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carloshenrq","download_url":"https://codeload.github.com/carloshenrq/php-grf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carloshenrq%2Fphp-grf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28779297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T11:46:04.308Z","status":"ssl_error","status_checked_at":"2026-01-26T11:46:02.664Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gravity-ragnarok-file","grf","php","php-grf","ragnarok","ragnarokonline"],"created_at":"2026-01-26T13:20:03.024Z","updated_at":"2026-01-26T13:20:03.749Z","avatar_url":"https://github.com/carloshenrq.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP-GRF [![release](https://img.shields.io/github/release/carloshenrq/php-grf.svg)](https://github.com/carloshenrq/php-grf/releases) [![license](https://img.shields.io/github/license/carloshenrq/php-grf.svg)](https://github.com/carloshenrq/php-grf)\r\n\r\nThis is a lib to allow PHP to read and write GRF (Gravity Ragnarok Files).\r\n\r\n### Build Status\r\n\r\n[![Build Status](https://travis-ci.com/carloshenrq/php-grf.svg?branch=master)](https://travis-ci.com/carloshenrq/php-grf) [![Build status](https://ci.appveyor.com/api/projects/status/pgw1am9vx6i7lhqk?svg=true)](https://ci.appveyor.com/project/carloshenrq/php-grf) [![issues](https://img.shields.io/github/issues/carloshenrq/php-grf.svg)](https://github.com/carloshenrq/php-grf/issues) [![pull-request](https://img.shields.io/github/issues-pr/carloshenrq/php-grf.svg)](https://github.com/carloshenrq/php-grf/pulls)\r\n\r\n### Code Quality\r\n\r\n[![CodeFactor](https://www.codefactor.io/repository/github/carloshenrq/php-grf/badge/master)](https://www.codefactor.io/repository/github/carloshenrq/php-grf/overview/master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/791bcc480eac42cb937183daf5b827ae)](https://www.codacy.com/app/carloshenrq/php-grf?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=carloshenrq/php-grf\u0026amp;utm_campaign=Badge_Grade)\r\n\r\n### Code Coverage\r\n\r\n[![codecov](https://codecov.io/gh/carloshenrq/php-grf/branch/master/graph/badge.svg)](https://codecov.io/gh/carloshenrq/php-grf) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/791bcc480eac42cb937183daf5b827ae)](https://www.codacy.com/app/carloshenrq/php-grf?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=carloshenrq/php-grf\u0026utm_campaign=Badge_Coverage)\r\n\r\n## How i can colaborate?\r\n\r\nPlease! check our issues and if you can fix or add new features, you're welcome.\r\n\r\nAlso, see if what you're about to change is in ours pull requests.\r\n\r\n## How to open a file to read?\r\n\r\nThe code ahead, will show you how to extract all files inside grf.\r\n\r\n```\r\n\u003c?php\r\nrequire_once 'php-grf/lib/autoload.php';\r\n\r\n// Instance a reader/writer for your grf file\r\n$grf = new GrfFile('php-grf/tests/test200.grf');\r\n\r\nforeach ($grf-\u003egetEntries() as $entry) {\r\n    $dir = dirname($entry-\u003egetFilename());\r\n\r\n    if (is_dir($dir) === false)\r\n        mkdir ($dir, 0777, true);\r\n\r\n    $file = str_replace('\\\\', '/', $entry-\u003egetFilename());\r\n    $buffer = $entry-\u003egetUnCompressedBuffer();\r\n\r\n    $fp = fopen($file, 'wb');\r\n    fwrite($fp, $buffer);\r\n    fflush($fp);\r\n    fclose($fp);\r\n}\r\n\r\n// Dispose all resources used\r\n$grf = null;\r\n```\r\n\r\nIf you wanna search inside entries:\r\n\r\n```\r\n\u003c?php\r\nrequire_once 'php-grf/lib/autoload.php';\r\n\r\n// Instance a reader/writer for your grf file\r\n$grf = new GrfFile('php-grf/tests/test200.grf');\r\n\r\n// Find all files in entries (including added)\r\n// when uncompressed the size is more then 1000 bytes.\r\n$search = $grf-\u003egetEntries()-\u003ewhere(function($entry) {\r\n\treturn $entry-\u003egetUnCompressedSize() \u003e 1000;\r\n});\r\n\r\n// Dispose all resources used\r\n$grf = null;\r\n```\r\n\r\nKnow the full path inside grf the file is?\r\n\r\n```\r\n\u003c?php\r\nrequire_once 'php-grf/lib/autoload.php';\r\n\r\n// Instance a reader/writer for your grf file\r\n$grf = new GrfFile('php-grf/tests/test200.grf');\r\n$entries = $grf-\u003egetEntries();\r\n$entry = $entries['data\\\\0_Tex1.bmp'];\r\n\r\nif ($entry === null) { // not found\r\n\r\n}\r\n\r\n// Dispose all resources used\r\n$grf = null;\r\n```\r\n\r\n## How to open a grf file to write?\r\n\r\nThe same way you open to read, you can write. See:\r\n\r\n```\r\nrequire_once 'php-grf/lib/autoload.php';\r\n\r\n// Instance a reader/writer for your grf file\r\n$grf = new GrfFile('php-grf/tests/test200.grf');\r\n\r\n$grf-\u003eaddFile('file-outside.txt', 'data\\\\file-inside.txt');\r\n\r\n// Dispose all resources used\r\n$grf-\u003eclose(); // Auto save when closed\r\n$grf = null;\r\n```\r\n\r\nWhen you call `$grf-\u003esave()` or `$grf-\u003eclose()` this'll repack your grf.\r\nLarge grf files may take some minutes to finish.\r\n\r\n## How to create a grf file to write?\r\n\r\nLook here how to create a new grf file:\r\n\r\n```\r\nrequire_once 'php-grf/lib/autoload.php';\r\n\r\n// Creates a new grf file with no files inside\r\n$grf = GrfFile::create('your-grf-file.grf');\r\n\r\n// Dispose all resources used\r\n$grf-\u003eclose(); // Auto save when closed\r\n$grf = null;\r\n```\r\n\r\nTo add files, just check the section above...\r\n\r\n## Install\r\n\r\nTo install, you only need use composer require to use.\r\n\r\n```\r\ncomposer require carloshlfz/php-grf\r\n```\r\n\r\nJust make sure you've `vendor/autoload.php` loaded and is just start to use.\r\n\r\n## Credits and other infos\r\n\r\nThe grf file inside tests folder `test200.grf` is from [arminherling/GRF](https://github.com/arminherling/GRF/).\r\n\r\nThis code is based on [MagicalTux/grf](https://github.com/MagicalTux/grf)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarloshenrq%2Fphp-grf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarloshenrq%2Fphp-grf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarloshenrq%2Fphp-grf/lists"}