PHPackages                             whitedigital-eu/config-pack - 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. whitedigital-eu/config-pack

ActiveLibrary

whitedigital-eu/config-pack
===========================

PhpCsFixer configuration to use in other organization repositories

2.1.0(3y ago)01.1k↑650%1[2 issues](https://github.com/whitedigital-eu/config-pack/issues)7MITPHPPHP &gt;=8.1.0

Since Dec 1Pushed 1y agoCompare

[ Source](https://github.com/whitedigital-eu/config-pack)[ Packagist](https://packagist.org/packages/whitedigital-eu/config-pack)[ RSS](/packages/whitedigital-eu-config-pack/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (7)

config-pack
===========

[](#config-pack)

> **WARNING**
> When upgrading from **v1** to **v2**, it is better to run `composer update` without scripts and plugins, as v2 does not require `symfony/phpunit-bridge` anymore and uninstalling it may change or delete test related files, like `.env.test` or `phpunit.xml.dist`:
>
> `composer update -nW --no-scripts --no-plugins whitedigital-eu/config-pack`

---

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

[](#installation)

```
composer require --dev whitedigital-eu/config-pack
```

Usage
-----

[](#usage)

### PhpCsFixer:

[](#phpcsfixer)

```
vendor/bin/php-cs-fixer --config=vendor/whitedigital-eu/config-pack/.php-cs-fixer.php fix
```

In PhpStorm:

- point to same config file in settings of PHP CS Fixer
- check "allow risky rules" checkbox
- choose custom ruleset
- point to php-cs-fixer binary

### PhpUnit:

[](#phpunit)

```
vendor/bin/phpunit --log-junit report.xml --configuration vendor/whitedigital-eu/config-pack/phpunit.xml.dist tests
```

*or if tests/bootstrap.php differs from one in whitedigital-eu/config-pack:*

```
vendor/bin/phpunit --log-junit report.xml --configuration vendor/whitedigital-eu/config-pack/phpunit.xml.dist --bootstrap=tests/bootstrap.php tests
```

### PhpStan

[](#phpstan)

```
vendor/bin/phpstan --configuration=vendor/whitedigital-eu/config-pack/phpstan.neon.dist analyse src
```

In PhpStorm:

- point to same config file in settings of PHPStan
- point to your project's autoload, usually `vendor/autoload.php`
- point to phpstan binary

Functional usage (since v2.2)
-----------------------------

[](#functional-usage-since-v22)

> ConfigPack only works in dev and test environments, make sure you set this config only for dev and test.
>
> `/** config/bundles.php */`
> `WhiteDigital\Config\ConfigPack::class => ['dev' => true, 'test' => true]`

### Faker

[](#faker)

This package now comes with `fakerphp/faker` as a dependency thus making usage of fake data generation easier. If used without `AbstractTestCase` or `AbstractFixture`, you can easily use faker using `FakerTrait`.

```
use WhiteDigital\Config\Faker;
use WhiteDigital\Config\Traits\FakerTrait;

class Test
{
    use FakerTrait;

    public function __construct(Faker $faker)
    {
        self::setFaker($faker);
    }

    public function test(): string
    {
        return self::text();
    }
}
```

As `Faker` is used with this library's configuration, `setFaker` function call is mandatory before using any faker functionality.
`Faker` is autowired automatically. `FakerTrait` primarily passes through functions from faker factory, most useful methods are defined as methods in annotation so IDE can see them.
By default Faker uses `lv_LV` as locale and `2022` as seed. If different values are needed, you can configure them:

```
config_pack:
    seed: 123
    locale: en_US
```

```
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Config\ConfigPackConfig;

return static function (ConfigPackConfig $config, ContainerConfigurator $container): void {
    if (in_array($container->env(), ['dev', 'test', ], true)) {
        $config
            ->seed(123)
            ->locale('en_US');
    }
};
```

### AbstractTestCase

[](#abstracttestcase)

As most of tests for testing api-platform apis are somewhat similar, `AbstractTestCase` defines a lot of useful functions to make testing apis a lot easier.
In overall, with using `AbstractTestCase` usual api test should look like this:

```
use WhiteDigital\Config\Test\AbstractTestCase;
use WhiteDigital\Config\Test\Traits;

class CustomerTest extends AbstractTestCase
{
    use Traits\DeleteItem;
    use Traits\GetCollection;
    use Traits\GetItem;
    use Traits\GetItemNotFound;

    protected static string $iri = '/api/customers';

    public function testPostItem(): int
    {
        return self::post([
            'key1' => self::words(),
            'key2' => self::text(),
            'key3' => self::randomDecimal(),
        ])->id;
    }

    #[Depends('testPostItem')]
    public function testPatchItem(int $id): int
    {
        return self::patch($id, [
            'key3' => self::randomDigit(),
        ])->id;
    }
}
```

This tests:
`GET`: /api/customers/{id}
`GET`: /api/customer/{not\_existing\_id}
`GET`: /api/customers
`POST`: /api/customers
`PATCH`: /api/customers/{id}
`DELETE`: /api/customers/{id}

Tests by default uses authentication, you can configure `login_email` and `login_password` in `config_pack` configuration:

```
config_pack:
    login_email: test@test.com
    login_password: test
```

```
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Config\ConfigPackConfig;

return static function (ConfigPackConfig $config, ContainerConfigurator $container): void {
    if (in_array($container->env(), ['dev', 'test', ], true)) {
        $config
            ->loginEmail('test@test.com')
            ->loginPassword('test');
    }
};
```

### AbstractFixture

[](#abstractfixture)

Similarly to `AbstractTestCase`, `AbstractFixture` defines base functions for doctrine fixtures. It also uses `FakerTrait` to simplify data generation.

```
use Doctrine\Persistence\ObjectManager;
use WhiteDigital\Config\DataFixture\AbstractFixture;

class OneFixture extends AbstractFixture
{
    public function load(ObjectManager $manager): void
    {
        $fixture = (new One())
            ->setKey1(self::words())
            ->setKey2(self::rnadomDecimal());

        $manager->persist($fixture);
        $manager->flush();

        $this->reference($fixture);
    }
}

class TwoFixture extends AbstractFixture
{
    public function load(ObjectManager $manager): void
    {
        for($i = 0; $i < 10; $i++){
            $fixture = (new Two())
                ->setKey1(self::words())
                ->setKey2($this->getEntity(One::class));

            $manager->persist($fixture);
            $manager->flush();

            $this->reference($fixture, $i);
        }
    }

    public function getDependencies() : array
    {
        $dependencies = parent::getDependencies();
        $dependencies[] = OneFixture::class;

        return $dependencies;
    }
}
```

`AbstractFixture` defines some useful functions:

`getEntity` -&gt; `getEntity(Entity::class)`: returns entity object for given class if fixture, where this class is created, is added to dependencies and dependant fixture defines reference.

`getImage` and `getFile`: coupled with `whitedigital-eu/storage-item-resource` library, these functions return entity for `StorageItem` based on need -&gt; image or text file.

`reference`: set current fixture to references to be used elsewhere where this fixture is a dependency

`getClassifier`: explicitly returns Classifier if project contains any classifiers and project Classifier fixture extends `BaseClassifierFixture`.

### BaseClassifierFixture

[](#baseclassifierfixture)

If your project have any classifier logic, you can extend `BaseClassifierFixture` and it will make classifier creation easier.
You need to have an entity with at least this structure to make this work:

```
use Doctrine\ORM\Mapping\Entity;

#[Entity]
class Classifier
{
    private ?int $id = null;
    private ?string $value = null;
    private ?array $data = [];
    private ?ClassifierType $type = null;
}
```

And you need to have a Backed enum (here called `ClassifierType`).
Example of `ClassifierType` is something like this:

```
enum ClassifierType: string
{
    case ONE = 'ONE';
    case TWO = 'TWO';
}
```

With `BaseClassifierFixture` classifiers can be created using two ways:
simple:

```
use WhiteDigital\Config\DataFixture\BaseClassifierFixture;

class ClassifierFixture extends BaseClassifierFixture
{
    public function __construct()
    {
        parent::__construct(Classifier::class);
    }

    public function load(ObjectManager $manager): void
    {
        $classifiers = [
            'ONE' => ClassifierType::ONE,
            'TWO' => ClassifierType::TWO;
        ];

        $this->loadFixtures($manager, $classifiers);
    }
}
```

with data:

```
use WhiteDigital\Config\DataFixture\BaseClassifierFixture;

class ClassifierFixture extends BaseClassifierFixture
{
    public function __construct()
    {
        parent::__construct(Classifier::class);
    }

    public function load(ObjectManager $manager): void
    {
        $classifiers = [
            'ONE' => ['classifier' => ClassifierType::ONE, 'data' => ['data' => 'one']],
            'TWO' => ['classifier' => ClassifierType::TWO, 'data' => ['data' => 'two']],
        ];

        $this->loadFixtures($manager, $classifiers);
    }
}
```

dependant:

```
use WhiteDigital\Config\DataFixture\BaseClassifierFixture;

class ClassifierFixture extends BaseClassifierFixture
{
    public function __construct()
    {
        parent::__construct(Classifier::class);
    }

    public function load(ObjectManager $manager): void
    {
        $classifiers = [
            'ONE' => ClassifierType::ONE,
        ];

        $this->loadFixtures($manager, $classifiers);

        $dependants = [
            'TWO' => ['classifier' => ClassifierType::TWO, 'data' => ['one_iri' => '/api/classifiers/' . $this->getClassifier(ClassifierType::ONE)->getId(), ], ],
        ];

        $this->loadFixtures($manager, $dependants);
    }
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~23 days

Total

5

Last Release

1163d ago

Major Versions

1.1.0 → 2.0.02023-02-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/c4db85e32518c5a6caa2fd625032a2b016ef42d60cf8a101c165cc5c0048b221?d=identicon)[k0d3r1s](/maintainers/k0d3r1s)

![](https://www.gravatar.com/avatar/d54d4c03974bdc6923785b90b54575e77570057e72fd6b9915e06656e60b842e?d=identicon)[andis.cirulis](/maintainers/andis.cirulis)

---

Top Contributors

[![k0d3r1s](https://avatars.githubusercontent.com/u/38725938?v=4)](https://github.com/k0d3r1s "k0d3r1s (38 commits)")[![acirulis](https://avatars.githubusercontent.com/u/27766961?v=4)](https://github.com/acirulis "acirulis (3 commits)")

---

Tags

phpsymfonyPHPStanconfigphp-cs-fixercs-fixer

### Embed Badge

![Health badge](/badges/whitedigital-eu-config-pack/health.svg)

```
[![Health](https://phpackages.com/badges/whitedigital-eu-config-pack/health.svg)](https://phpackages.com/packages/whitedigital-eu-config-pack)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[sci3ma/symfony-grumphp

Configured GrumPHP with bunch of tools for static code analysis Symfony Framework

196.7k](/packages/sci3ma-symfony-grumphp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
