{"id":24540681,"url":"https://github.com/mistralys/cyberpunk-mod-db-php","last_synced_at":"2026-03-02T06:03:08.668Z","repository":{"id":257428423,"uuid":"858214128","full_name":"Mistralys/cyberpunk-mod-db-php","owner":"Mistralys","description":"PHP Classes to access the Cyberpunk 2077 Clothing Mod DB.","archived":false,"fork":false,"pushed_at":"2025-05-13T18:23:51.000Z","size":480,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-25T17:49:43.224Z","etag":null,"topics":["cyberpunk-2077","database-access-library","game-library","php-library"],"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/Mistralys.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,"zenodo":null}},"created_at":"2024-09-16T14:06:15.000Z","updated_at":"2025-05-13T18:23:17.000Z","dependencies_parsed_at":"2024-09-16T17:51:31.058Z","dependency_job_id":"624a26da-03f8-4e10-9bf5-f74b06f0a92f","html_url":"https://github.com/Mistralys/cyberpunk-mod-db-php","commit_stats":null,"previous_names":["mistralys/cyberpunk-mod-db-php"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/Mistralys/cyberpunk-mod-db-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fcyberpunk-mod-db-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fcyberpunk-mod-db-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fcyberpunk-mod-db-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fcyberpunk-mod-db-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mistralys","download_url":"https://codeload.github.com/Mistralys/cyberpunk-mod-db-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fcyberpunk-mod-db-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29993544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cyberpunk-2077","database-access-library","game-library","php-library"],"created_at":"2025-01-22T18:14:40.941Z","updated_at":"2026-03-02T06:03:08.633Z","avatar_url":"https://github.com/Mistralys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cyberpunk 2077 Clothing Mods DB for PHP\n\nPHP library used to access the data provided by the \n[Cyberpunk 2077 Clothing Mod DB](https://github.com/Mistralys/cyberpunk-mod-db).\n\n## Features\n\n- Classes used to access all data in the mod DB\n- Get mod information, including screenshots\n- Filter mods by search terms and tags\n- Filter mod items by search terms and tags\n- Access all known tags used in the mod DB\n- Access all atelier mods used by the clothing mods\n- Minimum configuration required\n\n## Requirements\n\n- PHP 8.2 or higher\n- [Composer](https://getcomposer.org/)\n- Webserver with PHP support\n\n## Installation\n\n1. Require the package using Composer\n2. Ensure that the `vendor` directory is accessible via the webserver.\n\n```bash\ncomposer require mistralys/cyberpunk-mod-db-php\n```\n\n\u003e NOTE: The database is included as a dependency, so there is no need to \n\u003e require it separately, unless you want a specific version to be installed.\n\n## Accessing mods\n\n### The mod collection class\n\nThe mod collection class `ModCollection` is the main entry point to the \nmod database. It provides methods to access all mods, as well as the \nfiltering capabilities.\n\n```php\nuse CPMDB\\Mods\\Collection\\ModCollection;\n\n// Create a collection instance\n$collection = ModCollection::create(\n    __DIR__.'/vendor', // Absolute path to the composer vendor directory\n    __DIR__.'/cache', // Path to a writable directory to store cache files\n    'http://127.0.0.1/your-app/vendor' // Absolute URL to the composer vendor directory\n);\n\n// Get all mods\n$mods = $collection-\u003egetAll();\n\n// Get only clothing mods\n$clothing = $collection-\u003ecategoryClothing()-\u003egetAll();\n\n// Get a mod by its UUID (unique identifier, category ID + mod ID)\n$catsuit = $collection-\u003egetByID('clothing.catsuit');\n\n// Get the screenshot URL for a mod\n$images = $catsuit-\u003egetScreenshotCollection();\nif($images-\u003ehasScreenshots()) {\n    $default = $images-\u003egetDefault();\n    ?\u003e\n    \u003cimg src\"\u003c?php php echo $default-\u003egetURL() ?\u003e\" alt=\"\u003c?php echo $default-\u003egetTitle() ?\u003e\"\u003e\n    \u003c?php\n}\n```\n\n### Searching for mods\n\nUse the mod filter to search for specific mods by search terms and/or tags.\n\n```php\nuse CPMDB\\Mods\\Collection\\ModCollection;\nuse \\CPMDB\\Mods\\Tags\\Types\\Outfit;\n\n// Create a collection instance\n$collection = ModCollection::create(\n    __DIR__.'/vendor', // Absolute path to the composer vendor directory\n    __DIR__.'/cache', // Path to a writable directory to store cache files\n    'http://127.0.0.1/your-app/vendor' // Absolute URL to the composer vendor directory\n);\n\n// Search for \"catsuit\" and only get mods with the \"Outfit\" tag\n$mods = $collection-\u003ecreateFilter()\n    -\u003eselectSearchTerm('catsuit')\n    -\u003eselectTag(Outfit::TAG_NAME)\n    -\u003egetMods();\n```\n\n## Accessing mod items\n\nEach mod can contain multiple items, such as clothing items. \nWhile each mod has a collection of items, there is also a global\nitem collection that contains all items from all mods.\n\n### The item collection class\n\n```php\nuse CPMDB\\Mods\\Collection\\ModCollection;\n\n// Create a collection instance\n$collection = ModCollection::create(\n    __DIR__.'/vendor', // Absolute path to the composer vendor directory\n    __DIR__.'/cache', // Path to a writable directory to store cache files\n    'http://127.0.0.1/your-app/vendor' // Absolute URL to the composer vendor directory\n);\n\n// Get the item collection\n$itemsCollection = $collection-\u003egetItemCollection();\n\n// Get an item by its CET code \n$dress = $itemsCollection-\u003egetByID('nd_michiko_dress_black');\n\n// Get the CET command to add the item in-game\n$dress-\u003egetCETCommand();\n```\n\n### Searching for items\n\nUse the item filter to search for specific items by search terms and/or tags.\n\n```php\nuse CPMDB\\Mods\\Collection\\ModCollection;\nuse CPMDB\\Mods\\Tags\\Types\\Jewelry;\n\n// Create a collection instance\n$collection = ModCollection::create(\n    __DIR__.'/vendor', // Absolute path to the composer vendor directory\n    __DIR__.'/cache', // Path to a writable directory to store cache files\n    'http://127.0.0.1/your-app/vendor' // Absolute URL to the composer vendor directory\n);\n\n// Search for the Jewelry tag to get all jewelry mod items\n$mods = $collection-\u003ecreateItemFilter()\n    -\u003eselectTag(Jewelry::TAG_NAME)\n    -\u003egetItems();\n\n// Use the item collection for helper methods like getting\n// items by their CET code\n$mods = $collection-\u003ecreateItemFilter()\n    -\u003eselectTag(Jewelry::TAG_NAME)\n    -\u003egetItemsAsCollection()\n    -\u003egetByItemCode('earrings_08_basic_04_kwek');\n\n// Combine as many filter criteria as needed\n$mods = $collection-\u003ecreateItemFilter()\n    -\u003eselectSearchTerm('earrings')\n    -\u003eselectTag(Jewelry::TAG_NAME)\n    -\u003eselectTag(Physics::TAG_NAME)\n    -\u003egetItemsAsCollection();\n```\n\n\u003e NOTE: Items inherit their tags from the mod they belong to. Since a\n\u003e mod can have items that belong to different tags, searching for\n\u003e a specific tag may return unrelated items.\n\n## Handle result pagination\n\nAll results from the mod or item filters are paginated. Without specifying\nany options, the filters will return the first page of results, with \n20 results per page.\n\nA pagination helper object can be used to get information on the pagination.\n\n```php\nuse CPMDB\\Mods\\Collection\\ModCollection;\nuse CPMDB\\Mods\\Tags\\Types\\Jewelry;\n\n// Create a collection instance\n$collection = ModCollection::create(\n    __DIR__.'/vendor', // Absolute path to the composer vendor directory\n    __DIR__.'/cache', // Path to a writable directory to store cache files\n    'http://127.0.0.1/your-app/vendor' // Absolute URL to the composer vendor directory\n);\n\n// Search for the Jewelry tag to get all jewelry mod items\n$filter = $collection-\u003ecreateItemFilter()\n    -\u003esetResultsPerPage(60)\n    -\u003eselectResultPage(2)\n    -\u003eselectTag(Jewelry::TAG_NAME);\n\n// The pagination must be handled after all filter criteria have been selected.\n$pagination = $filter-\u003egetPagination();\n\n// Check if there is a next page\nif($pagination-\u003ehasNextPage()) {\n    $nextNumber = $pagination-\u003egetNextPage();\n}\n\n// Check if there is a previous page\nif($pagination-\u003ehasPreviousPage()) {\n    $previousNumber = $pagination-\u003egetPreviousPage();\n}\n\n$items = $filter-\u003egetItemsAsCollection();\n```\n\n## Accessing tags\n\nTags are used to categorize mods, using simple strings defined in the mod files\n(e.g. `CET` for the Cyber Engine Tweaks mod). All known tags used in the mod DB\nare included in the package.\n\n### Available meta data\n\nEach tag has the following meta-data:\n\n- Name: The tag's name, e.g. `CET`.\n- Full name: The tag's full name, e.g. `Cyber Engine Tweaks`.\n- Description: A short description of the tag.\n- Category: The tag's category, e.g. `Modder Resource`.\n- Related tags: Tags that are related to the current tag, if any.\n- Links: Links to external resources related to the tag, if any.\n\n### Tag name constants\n\nTags can be referenced in code using the matching tag classes, which all have\na constant with the tag's name. This makes it easier to avoid typos.\n\n```php\n$cetTag = \\CPMDB\\Mods\\Tags\\Types\\CyberEngineTweaks::TAG_NAME;\n$clothingTag = \\CPMDB\\Mods\\Tags\\Types\\Clothing::TAG_NAME;\n```\n\nAn alternative way is to use the `TagNames` class, which has constants for all\nknown tags. This can be easier to use in some cases.\n\n```php\nuse CPMDB\\Mods\\Tags\\TagNames;\n\n$cetTag = TagNames::TAG_CET;\n$clothingTag = TagNames::TAG_CLOTHING;\n```\n\n### The tag collection\n\nAll known tags are available via the `TagCollection` class, which has methods\nto access them.\n\n```php\nuse CPMDB\\Mods\\Tags\\TagCollection;\nuse CPMDB\\Mods\\Tags\\Types\\CyberEngineTweaks;\n\n$collection = TagCollection::getInstance();\n\n// Get all tags\n$all = $collection-\u003egetAll();\n\n// Get a specific tag\n$cet = $collection-\u003egetByID(CyberEngineTweaks::TAG_NAME);\n\n// Additional tag meta data\necho 'Description: '.$cet-\u003egetDescription();\necho 'Tag category: '.$cet-\u003egetCategory();\n```\n\n## Accessíng atelier mods\n\n\u003e Background: To make clothing items added by mods available to purchase in-game, the\n\u003e [Virtual Atelier](https://www.nexusmods.com/cyberpunk2077/mods/2987) mod is used. \n\u003e Modders can create atelier mods that contain the clothing items they have created.\n\nFor the clothing mods, all related atelier mods are included in the `AtelierCollection` \nclass to access their metadata. Individual mods provide their own atelier instance \nvia the `getAtelier()` method, but the atelier collection offers top-level access \nto all of them.\n\n### Available metadata\n\nEach atelier has the following meta-data:\n\n- ID: The atelier's unique identifier, e.g. `nc-fashion`.\n- Name: The atelier's name, e.g. `NC Fashion`.\n- URL: A link to the atelier mod's home page.\n- Authors: A list of the mod's author names.\n- Mods: All database-known mods that belong to the atelier.\n\n### The atelier collection\n\nGetting the atelier collection is done via the mod collection:\n\n```php\nuse CPMDB\\Mods\\Ateliers\\AtelierCollection;\nuse CPMDB\\Mods\\Collection\\ModCollection;\nuse \\CPMDB\\Mods\\Ateliers\\Atelier\\NcFashionAtelier;\n\n// Create a collection instance\n$collection = ModCollection::create(\n    __DIR__.'/vendor', // Absolute path to the composer vendor directory\n    __DIR__.'/cache', // Path to a writable directory to store cache files\n    'http://127.0.0.1/your-app/vendor' // Absolute URL to the composer vendor directory\n);\n\n$ateliers = $collection-\u003ecreateAteliers();\n\n// Get all ateliers\n$all = $ateliers-\u003egetAll();\n\n// Get a specific atelier\n$ncFashion = $ateliers-\u003egetByID(NcFashionAtelier::ATELIER_ID);\n```\n\n### Getting a mod's atelier\n\n```php\n```\n\n## Caching\n\nBy default, the collection will cache the mod data in the specified\ncache directory. This is done for performance reasons, as the mod data\nis read from my individual files in the filesystem.\n\nThe cache is created and updated automatically following the version\nof the mod database.\n\n### Turning off caching\n\nThe caching can be turned off if needed:\n\n```php\nuse CPMDB\\Mods\\Collection\\DataWriter\\CacheDataWriter;\n\nCacheDataWriter::setCacheEnabled(false);\n```\n\n### Performance tests\n\nTo check the performance of the caching on your system, you can run\nthe performance tests:\n\n```bash\nphp tests/performance/performance-test.php\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistralys%2Fcyberpunk-mod-db-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmistralys%2Fcyberpunk-mod-db-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistralys%2Fcyberpunk-mod-db-php/lists"}