PHPackages                             mistralys/cyberpunk-mod-db-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mistralys/cyberpunk-mod-db-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mistralys/cyberpunk-mod-db-php
==============================

PHP classes to work with the Cyberpunk 2077 DB.

1.8.0(12mo ago)051MITPHPPHP &gt;=8.2

Since Sep 16Pushed 12mo ago1 watchersCompare

[ Source](https://github.com/Mistralys/cyberpunk-mod-db-php)[ Packagist](https://packagist.org/packages/mistralys/cyberpunk-mod-db-php)[ RSS](/packages/mistralys-cyberpunk-mod-db-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (15)Used By (0)

Cyberpunk 2077 Clothing Mods DB for PHP
=======================================

[](#cyberpunk-2077-clothing-mods-db-for-php)

PHP library used to access the data provided by the [Cyberpunk 2077 Clothing Mod DB](https://github.com/Mistralys/cyberpunk-mod-db).

Features
--------

[](#features)

- Classes used to access all data in the mod DB
- Get mod information, including screenshots
- Filter mods by search terms and tags
- Filter mod items by search terms and tags
- Access all known tags used in the mod DB
- Access all atelier mods used by the clothing mods
- Minimum configuration required

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- [Composer](https://getcomposer.org/)
- Webserver with PHP support

Installation
------------

[](#installation)

1. Require the package using Composer
2. Ensure that the `vendor` directory is accessible via the webserver.

```
composer require mistralys/cyberpunk-mod-db-php
```

> NOTE: The database is included as a dependency, so there is no need to require it separately, unless you want a specific version to be installed.

Accessing mods
--------------

[](#accessing-mods)

### The mod collection class

[](#the-mod-collection-class)

The mod collection class `ModCollection` is the main entry point to the mod database. It provides methods to access all mods, as well as the filtering capabilities.

```
use CPMDB\Mods\Collection\ModCollection;

// Create a collection instance
$collection = ModCollection::create(
    __DIR__.'/vendor', // Absolute path to the composer vendor directory
    __DIR__.'/cache', // Path to a writable directory to store cache files
    'http://127.0.0.1/your-app/vendor' // Absolute URL to the composer vendor directory
);

// Get all mods
$mods = $collection->getAll();

// Get only clothing mods
$clothing = $collection->categoryClothing()->getAll();

// Get a mod by its UUID (unique identifier, category ID + mod ID)
$catsuit = $collection->getByID('clothing.catsuit');

// Get the screenshot URL for a mod
$images = $catsuit->getScreenshotCollection();
if($images->hasScreenshots()) {
    $default = $images->getDefault();
    ?>
