{"id":13409271,"url":"https://github.com/maxmind/MaxMind-DB-Reader-php","last_synced_at":"2025-03-14T14:31:06.474Z","repository":{"id":9469595,"uuid":"11353845","full_name":"maxmind/MaxMind-DB-Reader-php","owner":"maxmind","description":"PHP Reader for the MaxMind DB Database Format","archived":false,"fork":false,"pushed_at":"2025-02-24T20:07:26.000Z","size":470,"stargazers_count":653,"open_issues_count":5,"forks_count":81,"subscribers_count":40,"default_branch":"main","last_synced_at":"2025-03-10T00:34:16.982Z","etag":null,"topics":["geoip","geoip2","maxmind","mmdb"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxmind.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-11T21:43:03.000Z","updated_at":"2025-03-04T00:01:27.000Z","dependencies_parsed_at":"2023-12-17T20:02:08.907Z","dependency_job_id":"76a47da1-150e-49d6-b582-dbfd3fedbcf9","html_url":"https://github.com/maxmind/MaxMind-DB-Reader-php","commit_stats":{"total_commits":421,"total_committers":34,"mean_commits":"12.382352941176471","dds":"0.18527315914489306","last_synced_commit":"87906bb4416edc4a018dfa66f7787586cd1704e0"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxmind","download_url":"https://codeload.github.com/maxmind/MaxMind-DB-Reader-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243593330,"owners_count":20316168,"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":["geoip","geoip2","maxmind","mmdb"],"created_at":"2024-07-30T20:00:59.459Z","updated_at":"2025-03-14T14:31:06.450Z","avatar_url":"https://github.com/maxmind.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# MaxMind DB Reader PHP API #\n\n## Description ##\n\nThis is the PHP API for reading MaxMind DB files. MaxMind DB is a binary file\nformat that stores data indexed by IP address subnets (IPv4 or IPv6).\n\n## Installation (Composer) ##\n\nWe recommend installing this package with [Composer](https://getcomposer.org/).\n\n### Download Composer ###\n\nTo download Composer, run in the root directory of your project:\n\n```bash\ncurl -sS https://getcomposer.org/installer | php\n```\n\nYou should now have the file `composer.phar` in your project directory.\n\n### Install Dependencies ###\n\nRun in your project root:\n\n```\nphp composer.phar require maxmind-db/reader:~1.0\n```\n\nYou should now have the files `composer.json` and `composer.lock` as well as\nthe directory `vendor` in your project directory. If you use a version control\nsystem, `composer.json` should be added to it.\n\n### Require Autoloader ###\n\nAfter installing the dependencies, you need to require the Composer autoloader\nfrom your code:\n\n```php\nrequire 'vendor/autoload.php';\n```\n\n## Installation (Standalone) ##\n\nIf you don't want to use Composer for some reason, a custom\n`autoload.php` is provided for you in the project root. To use the\nlibrary, simply include that file,\n\n```php\nrequire('/path/to/MaxMind-DB-Reader-php/autoload.php');\n```\n\nand then instantiate the reader class normally:\n\n```php\nuse MaxMind\\Db\\Reader;\n$reader = new Reader('example.mmdb');\n```\n\n## Installation (RPM)\n\nRPMs are available in the [official Fedora repository](https://apps.fedoraproject.org/packages/php-maxminddb).\n\nTo install on Fedora, run:\n\n```bash\ndnf install php-maxminddb\n```\n\nTo install on CentOS or RHEL 7, first [enable the EPEL repository](https://fedoraproject.org/wiki/EPEL)\nand then run:\n\n```bash\nyum install php-maxminddb\n```\n\nPlease note that these packages are *not* maintained by MaxMind.\n\n## Usage ##\n\n## Example ##\n\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse MaxMind\\Db\\Reader;\n\n$ipAddress = '24.24.24.24';\n$databaseFile = 'GeoIP2-City.mmdb';\n\n$reader = new Reader($databaseFile);\n\n// get returns just the record for the IP address\nprint_r($reader-\u003eget($ipAddress));\n\n// getWithPrefixLen returns an array containing the record and the\n// associated prefix length for that record.\nprint_r($reader-\u003egetWithPrefixLen($ipAddress));\n\n$reader-\u003eclose();\n```\n\n## Optional PHP C Extension ##\n\nMaxMind provides an optional C extension that is a drop-in replacement for\n`MaxMind\\Db\\Reader`. In order to use this extension, you must install the\nReader API as described above and install the extension as described below. If\nyou are using an autoloader, no changes to your code should be necessary.\n\n### Installing Extension ###\n\nFirst install [libmaxminddb](https://github.com/maxmind/libmaxminddb) as\ndescribed in its [README.md\nfile](https://github.com/maxmind/libmaxminddb/blob/main/README.md#installing-from-a-tarball).\nAfter successfully installing libmaxmindb, you may install the extension\nfrom [pecl](https://pecl.php.net/package/maxminddb):\n\n```\npecl install maxminddb\n```\n\nAlternatively, you may install it from the source. To do so, run the following\ncommands from the top-level directory of this distribution:\n\n```\ncd ext\nphpize\n./configure\nmake\nmake test\nsudo make install\n```\n\nYou then must load your extension. The recommended method is to add the\nfollowing to your `php.ini` file:\n\n```\nextension=maxminddb.so\n```\n\nNote: You may need to install the PHP development package on your OS such as\nphp5-dev for Debian-based systems or php-devel for RedHat/Fedora-based ones.\n\n## 128-bit Integer Support ##\n\nThe MaxMind DB format includes 128-bit unsigned integer as a type. Although\nno MaxMind-distributed database currently makes use of this type, both the\npure PHP reader and the C extension support this type. The pure PHP reader\nrequires gmp or bcmath to read databases with 128-bit unsigned integers.\n\nThe integer is currently returned as a hexadecimal string (prefixed with \"0x\")\nby the C extension and a decimal string (no prefix) by the pure PHP reader.\nAny change to make the reader implementations always return either a\nhexadecimal or decimal representation of the integer will NOT be considered a\nbreaking change.\n\n## Support ##\n\nPlease report all issues with this code using the [GitHub issue tracker](https://github.com/maxmind/MaxMind-DB-Reader-php/issues).\n\nIf you are having an issue with a MaxMind service that is not specific to the\nclient API, please see [our support page](https://www.maxmind.com/en/support).\n\n## Requirements  ##\n\nThis library requires PHP 7.2 or greater.\n\nThe GMP or BCMath extension may be required to read some databases\nusing the pure PHP API.\n\n## Contributing ##\n\nPatches and pull requests are encouraged. All code should follow the PSR-1 and\nPSR-2 style guidelines. Please include unit tests whenever possible.\n\n## Versioning ##\n\nThe MaxMind DB Reader PHP API uses [Semantic Versioning](https://semver.org/).\n\n## Copyright and License ##\n\nThis software is Copyright (c) 2014-2024 by MaxMind, Inc.\n\nThis is free software, licensed under the Apache License, Version 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2FMaxMind-DB-Reader-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxmind%2FMaxMind-DB-Reader-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2FMaxMind-DB-Reader-php/lists"}