PHPackages                             brnshkr/config - 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. [Templating &amp; Views](/categories/templating)
4. /
5. brnshkr/config

ActiveComposer-plugin[Templating &amp; Views](/categories/templating)

brnshkr/config
==============

Centralized collection of configuration and tooling used across all @brnshkr projects

0.0.1-beta.3(1mo ago)15111↓71.4%21MITPHPPHP &gt;=8.5CI passing

Since Feb 10Pushed 1mo agoCompare

[ Source](https://github.com/brnshkr/config)[ Packagist](https://packagist.org/packages/brnshkr/config)[ Docs](https://github.com/brnshkr/config)[ RSS](/packages/brnshkr-config/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (61)Versions (21)Used By (1)

 [ ![@brnshkr/config project logo](https://raw.githubusercontent.com/brnshkr/brand/refs/heads/master/images/projects/config.png "@brnshkr/config") ](#top)
==========================================================================================================================================================

[![Semantic Versioning 2.0.0](https://camo.githubusercontent.com/1fed4343df401c9ab37adbb1f3da1d17c5173350a049d0bc6cbfc7b878dd3a0a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73656d7665722d322e302e302d626c75653f6c6162656c3d25463025394625393425393625323073656d766572267374796c653d666c61742d737175617265266c6162656c436f6c6f723d25323337663339396426636f6c6f723d253233613530393765)](https://semver.org/#semantic-versioning-200)[![MIT License](https://camo.githubusercontent.com/380889f4ae2c8bf66ed74b7f38a7364c15db25d49e02c423232f4771a036ab4a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62726e73686b722f636f6e6669672e7376673f6c6162656c3d2546302539462539332538332532306c6963656e7365267374796c653d666c61742d737175617265266c6162656c436f6c6f723d25323337663339396426636f6c6f723d253233613530393765)](https://github.com/brnshkr/config/blob/master/LICENSE)[![Stars](https://camo.githubusercontent.com/abda99b85f7b2ab33d51162b91958f7cb6d4a3b74f631a1ce0cfdd0492b05d58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f62726e73686b722f636f6e6669672e7376673f6c6162656c3d2545322541442539302532307374617273267374796c653d666c61742d737175617265266c6162656c436f6c6f723d25323337663339396426636f6c6f723d253233613530393765)](https://github.com/brnshkr/config/stargazers)[![Forks](https://camo.githubusercontent.com/2f49f7d2c0021bb46074f8eeb54442366a8c76b8d49a53494addd76f82340c54/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f62726e73686b722f636f6e6669672e7376673f6c6162656c3d254630253946253844254234253230666f726b73267374796c653d666c61742d737175617265266c6162656c436f6c6f723d25323337663339396426636f6c6f723d253233613530393765)](https://github.com/brnshkr/config/network/members)[![Issues](https://camo.githubusercontent.com/bfb5db3683acb320c8187e562abe1a4278e478c83f0abbed75d395cccd9dcf02/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f62726e73686b722f636f6e6669672e7376673f6c6162656c3d254630253946253941254138253230697373756573267374796c653d666c61742d737175617265266c6162656c436f6c6f723d25323337663339396426636f6c6f723d253233613530393765)](https://github.com/brnshkr/config/issues)[![Release](https://camo.githubusercontent.com/4be6fd0bd05f7db560cc7d404a7fa9dad6de968996c20b9f9fb4a31900dc50c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62726e73686b722f636f6e6669673f7374796c653d666c61742d737175617265266c6162656c3d2546302539462539332541362532306e706d2532467061636b6167697374266c6162656c436f6c6f723d37663339396426636f6c6f723d253233613530393765)](https://github.com/brnshkr/config/releases)

[](#--------)

Centralized collection of configuration and tooling used across all [@brnshkr](https://github.com/brnshkr) projects.

*[☄️ Bug Reports / Feature Requests »](https://github.com/brnshkr/config/issues)*

Table of Contents
-----------------

[](#table-of-contents)

- [👋 About the Project](#-about-the-project)
- [☕ JS](#-js)
    - [🧰 Prerequisites](#-prerequisites)
    - [🚀 Installation](#-installation)
        - [✋ Manual](#-manual)
        - [🎨 Custom](#-custom)
    - [👀 Usage](#-usage)
    - [💻 Development](#-development)
- [🐘 PHP](#-php)
    - [🧰 Prerequisites](#-prerequisites-1)
    - [🚀 Installation](#-installation-1)
        - [🤖 Automatic](#-automatic)
        - [✋ Manual](#-manual-1)
        - [🎨 Custom](#-custom-1)
    - [👀 Usage](#-usage-1)
    - [💻 Development](#-development-1)
- [🔨 TODOs / Roadmap](#-todos--roadmap)
- [❤️ Contributing](#%EF%B8%8F-contributing)
    - [💄 Commit Style](#-commit-style)
    - [⚙️ Workflows](#%EF%B8%8F-workflows)
- [🔖 Versioning](#-versioning)
- [📃 License](#-license)
- [🌐 Acknowledgments](#-acknowledgments)

[ ⬆ ](#top "Back to top")

👋 About the Project
-------------------

[](#-about-the-project)

**@brnshkr/config** is a centralized, opinionated collection of shared configuration files, tooling, and workflows for JavaScript and PHP projects. It helps standardizing linting, formatting, static analysis, and development workflows across repositories — reducing setup time, preventing config drift, and improving code quality and consistency.

> ❗ **Note** ❗
> While you're more than welcome to use this in your own projects, the configurations are tailored specifically for the [@brnshkr](https://github.com/brnshkr) ecosystem and may not be a perfect fit elsewhere.

[ ⬆ ](#top "Back to top")

☕ JS
----

[](#-js)

### 🧰 Prerequisites

[](#-prerequisites)

- Node.js &gt;= v24 or Bun &gt;= v1.3 (Older versions may work, but are untested)
- Any JavaScript package manager (Bun, Yarn, PNPM, NPM)

[ ⬆ ](#top "Back to top")

### 🚀 Installation

[](#-installation)

#### Bun

[](#bun)

```
bun a -D -E @brnshkr/config
```

#### Yarn

[](#yarn)

```
yarn add -D -E @brnshkr/config
```

#### PNPM

[](#pnpm)

```
pnpm add -D -E @brnshkr/config
```

#### NPM

[](#npm)

```
npm i -D -E @brnshkr/config
```

This repository currently only provides one way to integrate configuration files (An automatic setup is planned, See [🔨 TODOs / Roadmap](#-todos--roadmap)):

- [**Manual setup**](#-manual) by copying the example configuration files yourself

[ ⬆ ](#top "Back to top")

#### ✋ Manual

[](#-manual)

Take a look at the `peerDependencies` in the [package.json](./package.json) file and install the ones you need for the modules you want to use.
You can then copy the specific configs to your project:

##### TypeScript

[](#typescript)

```
cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.json
```

##### ESLint

[](#eslint)

```
cp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjs
```

##### Stylelint

[](#stylelint)

```
cp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjs
```

##### All

[](#all)

```
cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.json \
  && cp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjs \
  && cp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjs
```

[ ⬆ ](#top "Back to top")

#### 🎨 Custom

[](#-custom)

Take a look at the function signatures for exact details.

##### ESLint

[](#eslint-1)

```
// ./eslint.config.mjs

import { getConfig } from '@brnshkr/config/eslint';

export default getConfig(/* customize */);
```

##### Stylelint

[](#stylelint-1)

```
// ./stylelint.config.mjs

import { getConfig } from '@brnshkr/config/stylelint';

export default getConfig(/* customize */);
```

[ ⬆ ](#top "Back to top")

### 👀 Usage

[](#-usage)

#### Run Tooling

[](#run-tooling)

This package provides **configurations**, not a hard requirement on *how* you run tools.
A few possible ways are listed below:

##### Option 1 — Run Tools Directly (Most Flexible)

[](#option-1--run-tools-directly-most-flexible)

###### ESLint

[](#eslint-2)

Example call, adjust as needed

```
bun eslint --config ./conf/eslint.config.mjs --cache --cache-location ./.cache/eslint.cache.json
```

###### Stylelint

[](#stylelint-2)

Example call, adjust as needed

```
bun stylelint --config ./conf/stylelint.config.mjs --config-basedir ./ --cache --cache-location ./.cache/stylelint.cache.json **/*.{css,ejs,html,less,postcss,scss,svelte,svg,vue}
```

##### Option 2 — Run Helper Scripts (Bun Only, @brnshkr Convention)

[](#option-2--run-helper-scripts-bun-only-brnshkr-convention)

For these scripts to work you need to follow the convention of putting your configuration files into the [`./conf`](./conf) directory (Exactly how it is done in this project as well).

###### ESLint (TypeScript Only)

[](#eslint-typescript-only)

Expected configuration file: `./conf/eslint.config.ts`

```
bun ./node_modules/@brnshkr/config/dist/scripts/eslint.mjs
```

###### Stylelint

[](#stylelint-3)

Expected configuration file: `./conf/stylelint.config.mjs`

```
bun ./node_modules/@brnshkr/config/dist/scripts/stylelint.mjs
```

#### IDE Setup

[](#ide-setup)

When using the recommended way of putting config files into the `./conf` directory it might be neccesary to instruct your IDE to read these files correctly.
If you need a VSCode setup and have the specific [`extensions`](https://github.com/brnshkr/config/blob/master/.vscode/extensions.json) installed you can take a look at the `Project specific` section in [`./.vscode/settings.json`](https://github.com/brnshkr/config/blob/master/.vscode/settings.json).

[ ⬆ ](#top "Back to top")

### 💻 Development

[](#-development)

#### Setup

[](#setup)

Install dependencies and setup git hooks:

```
bun install \
  && bun install-hooks
```

#### Scripts

[](#scripts)

We recommend using the scripts provided in the [package.json](./package.json) file as the primary way of running common tasks.
Have a look yourself for a full list of available targets.

##### Common targets

[](#common-targets)

Here are some frequently used examples:

- `bun lint` — Run ESLint, Stylelint and Commitlint
- `bun inspect:eslint` — Inspect ESLint configuration
- `bun check` — Run TypeScript checks, linters and Vitest
- `bun run test` — Run Vitest test suite
- `bun test-update` — Run Vitest test suite and update snapshots
- `bun run build` — Build the project and generate types
- `bun watch` — Build the project in watch mode

[ ⬆ ](#top "Back to top")

🐘 PHP
-----

[](#-php)

### 🧰 Prerequisites

[](#-prerequisites-1)

- PHP &gt;= 8.5 (Older versions may work, but are untested)
- Composer &gt;= 2.9 (Older versions may work, but are untested)
- PHP Extensions:
    - `json`
    - `mbstring`

[ ⬆ ](#top "Back to top")

### 🚀 Installation

[](#-installation-1)

#### Composer

[](#composer)

```
composer r --dev brnshkr/config
```

This repository provides two ways to integrate configuration files and setup tools into your project:

- [**Automatic setup**](#-automatic) via the Composer plugin
- [**Manual setup**](#-manual-1) by copying the example configuration files yourself

#### 🤖 Automatic

[](#-automatic)

If you allow this package to run as a Composer plugin (Composer will prompt you on first install), several helper commands become available.
The most commonly used is the automatic setup command which installs packages for selected modules, copies example config files into your repository, and can optionally create a `Makefile` and/or a `.gitignore` file.

Run the automatic setup with defaults:

```
composer brnshkr:config:setup
```

Run the automatic setup with all flags enabled:

```
composer brnshkr:config:setup -gofacme
```

Take a look at the [plugin commands](#plugin-commands) section to see a full list of available commands.

[ ⬆ ](#top "Back to top")

#### ✋ Manual

[](#-manual-1)

Take a look at the `suggest`ed packages in the [composer.json](./composer.json) file and install the ones you need for the modules you want to use.
You can then copy the specific configs to your project:

##### PHP CS Fixer

[](#php-cs-fixer)

```
cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php \
  && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php.example \
  && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.dist.php.example ./conf/php-cs-fixer.dist.php
```

##### Rector

[](#rector)

```
cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php \
  && cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php.example \
  && cp -v ./vendor/brnshkr/config/conf/rector.dist.php.example ./conf/rector.dist.php
```

##### PHPStan

[](#phpstan)

```
cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php.example \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.dist.php.example ./conf/phpstan.dist.php
```

##### Twig CS Fixer

[](#twig-cs-fixer)

```
cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php \
  && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php.example \
  && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.dist.php.example ./conf/twig-cs-fixer.dist.php
```

##### Makefile

[](#makefile)

```
cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile
```

##### Gitignore

[](#gitignore)

```
cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore
```

##### All

[](#all-1)

```
cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php \
  && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php.example \
  && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.dist.php.example ./conf/php-cs-fixer.dist.php \
  && cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php \
  && cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php.example \
  && cp -v ./vendor/brnshkr/config/conf/rector.dist.php.example ./conf/rector.dist.php \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php.example \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.dist.php.example ./conf/phpstan.dist.php \
  && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php \
  && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php.example \
  && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.dist.php.example ./conf/twig-cs-fixer.dist.php \
  && cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile \
  && cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore
```

[ ⬆ ](#top "Back to top")

#### 🎨 Custom

[](#-custom-1)

Take a look at the function signatures for exact details.

##### PHP CS Fixer

[](#php-cs-fixer-1)

```
// ./php-cs-fixer.dist.php
