brnshkr / config
Centralized collection of configuration and tooling used across all @brnshkr projects
Requires
- php: >=8.5
- composer-plugin-api: ^2.0.0
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- ext-ctype: *
- ext-date: *
- ext-dom: *
- ext-fileinfo: *
- ext-filter: *
- ext-hash: *
- ext-iconv: *
- ext-libxml: *
- ext-openssl: *
- ext-pcre: *
- ext-phar: *
- ext-reflection: *
- ext-simplexml: *
- ext-tokenizer: *
- ext-xmlwriter: *
- composer/composer: 2.10.3
- dave-liddament/phpstan-rule-test-helper: 0.6.0
- friendsofphp/php-cs-fixer: 3.95.25
- helgesverre/toon: 3.2.1
- kubawerlos/php-cs-fixer-custom-fixers: 3.37.3
- matesofmate/composer-extension: 0.6.0
- matesofmate/phpstan-extension: 0.6.0
- matesofmate/phpunit-extension: 0.6.0
- matesofmate/rector-extension: 0.6.0
- pestphp/pest: 5.1.4
- phpat/phpat: 0.12.4
- phpstan/extension-installer: 1.4.3
- phpstan/phpstan: 2.2.13
- phpstan/phpstan-deprecation-rules: 2.0.5
- phpstan/phpstan-doctrine: 2.0.28
- phpstan/phpstan-phpunit: 2.0.18
- phpstan/phpstan-strict-rules: 2.0.12
- phpstan/phpstan-symfony: 2.0.20
- phpstan/phpstan-webmozart-assert: 2.0.0
- phpunit/phpunit: 13.3.2
- rector/rector: 2.6.6
- sebastian/diff: 9.0.1
- spatie/phpunit-snapshot-assertions: 5.4.0
- symfony/ai-mate: 0.12.0
- symfony/finder: 8.1.5
- symfony/process: 8.1.6
- symplify/phpstan-rules: 14.13.1
- ticketswap/phpstan-error-formatter: 1.3.0
- tomasvotruba/type-coverage: 2.3.6
- vincentlanglet/twig-cs-fixer: 4.1.1
Suggests
- friendsofphp/php-cs-fixer: Needed for automatically applying PHP coding standards
- kubawerlos/php-cs-fixer-custom-fixers: Optional additional PHP CS Fixer rules
- phpat/phpat: Optional architecture-related PHPStan rules
- phpstan/extension-installer: Optional for autoloading of additional PHPStan configurations
- phpstan/phpstan: Needed for static code analysis
- phpstan/phpstan-deprecation-rules: Optional PHPStan rules for deprecations
- phpstan/phpstan-doctrine: Optional additional PHPStan rules for Doctrine (It is recommended to configure parameters.doctrine.objectManagerLoader when using this extension)
- phpstan/phpstan-phpunit: Optional additional PHPStan rules for PHPUnit
- phpstan/phpstan-strict-rules: Optional strict PHPStan rules
- phpstan/phpstan-symfony: Optional additional PHPStan rules for Symfony (It is recommended to configure parameters.symfony.consoleApplicationLoader when using this extension)
- phpstan/phpstan-webmozart-assert: Optional additional PHPStan rules for Webmozart\Assert
- rector/rector: Needed for automatically applying upgrades and refactorings
- symfony/finder: Needed when using PHP CS Fixer, Rector or PHPStan
- symplify/phpstan-rules: Optional PHPStan rules by Symplify
- ticketswap/phpstan-error-formatter: Optional PHPStan error output formatter
- tomasvotruba/type-coverage: Optional type-related PHPStan rules
- vincentlanglet/twig-cs-fixer: Needed for automatically applying Twig coding standards
Provides
None
Conflicts
- friendsofphp/php-cs-fixer: <3.95.25 || >=4
- kubawerlos/php-cs-fixer-custom-fixers: <3.37.3 || >=4
- phpat/phpat: <0.12.4 || >=0.13
- phpstan/extension-installer: <1.4.3 || >=3
- phpstan/phpstan: <2.2.13 || >=3
- phpstan/phpstan-deprecation-rules: <2.0.5 || >=3
- phpstan/phpstan-doctrine: <2.0.28 || >=3
- phpstan/phpstan-phpunit: <2.0.18 || >=3
- phpstan/phpstan-strict-rules: <2.0.12 || >=3
- phpstan/phpstan-symfony: <2.0.20 || >=3
- phpstan/phpstan-webmozart-assert: <2.0.0 || >=3
- rector/rector: <2.6.6 || >=3
- symfony/finder: <8.1.5 || >=9
- symplify/phpstan-rules: <14.13.1 || >=15
- ticketswap/phpstan-error-formatter: <1.3.0 || >=2
- tomasvotruba/type-coverage: <2.3.6 || >=3
- vincentlanglet/twig-cs-fixer: <4.1.1 || >=5
Replaces
None
This package is auto-updated.
Last update: 2026-09-20 21:23:23 UTC
README
Centralized collection of configuration and tooling used across all @brnshkr projects.
☄️ Bug Reports / Feature Requests »
Table of Contents
- 👋 About the Project
- 📚 Documentation
- ☕ JS
- 🐘 PHP
- 🔨 TODOs / Roadmap
- ❤️ Contributing
- 🔖 Versioning
- 📃 License
- 🌐 Acknowledgments
👋 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 ecosystem and may not be a perfect fit elsewhere.
📚 Documentation
This README covers installation and usage. The full reference — custom rules, config builders, the Composer plugin,
the shared Makefile, and the development setup
— lives in ./docs, organized by stack and tool.
☕ JS
🧰 Prerequisites
- Node.js >= v24.15 or Bun >= v1.4 (Older versions may work, but are untested)
- Any JavaScript package manager (Bun, Yarn, PNPM, NPM)
🚀 Installation
Bun
bun a -D -E @brnshkr/config
Yarn
yarn add -D -E @brnshkr/config
PNPM
pnpm add -D -E @brnshkr/config
NPM
npm i -D -E @brnshkr/config
Take a look at the peerDependencies in the package.json file
and install the ones you need for the modules you want to use.
Copy the starter Makefile once, and let it write the rest:
cp -v ./node_modules/@brnshkr/config/conf/Makefile.dist ./Makefile \
&& make startup
make startup installs each stack, writes every config and .gitignore the project is missing, and never
touches a file that is already there.
🎨 Custom
Take a look at the function signatures for exact details.
ESLint
// ./conf/eslint.mjs import { getConfig } from '@brnshkr/config/eslint'; export default getConfig(/* customize */);
Stylelint
// ./conf/stylelint.mjs import { getConfig } from '@brnshkr/config/stylelint'; export default getConfig(/* customize */);
markdownlint
// ./conf/markdownlint.mjs import { getConfig } from '@brnshkr/config/markdownlint'; export default getConfig(/* customize */);
commitlint
// ./conf/commitlint.mjs import { getConfig } from '@brnshkr/config/commitlint'; export default getConfig(/* customize */);
Vitest
// ./conf/vitest.mjs import { getConfig } from '@brnshkr/config/vitest'; export default getConfig(/* customize */);
👀 Usage
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)
ESLint
Example call, adjust as needed
bun eslint --config ./conf/eslint.mjs --cache --cache-location ./.cache/eslint.cache.json --max-warnings 0
Stylelint
Example call, adjust as needed
bun stylelint --config ./conf/stylelint.mjs --config-basedir ./ --cache --cache-location ./.cache/stylelint.cache.json --max-warnings 0 "**/*.{css,ejs,html,less,postcss,scss,svelte,svg,vue}"
markdownlint
Example call, adjust as needed
bun markdownlint-cli2 --config ./conf/markdownlint.mjs "**/*.md"
commitlint
Example call, adjust as needed
bun commitlint --config ./conf/commitlint.mjs --edit
Option 2 — Run Make Targets (@brnshkr Convention)
For these targets to work you need to follow the convention of putting your configuration files into the ./conf directory
(Exactly how it is done in this project as well; see ./conf).
Your own Makefile includes this one. Copy the starter rather than writing the include by hand: it guards the
include, so a fresh clone can make bootstrap before anything is installed.
cp -v ./node_modules/@brnshkr/config/conf/Makefile.dist ./Makefile
A target appears once the tool it runs is installed, so make help lists what your repository actually has,
make ci runs all of it, and make startup writes any config you are still missing.
The full reference is docs/Makefile.md.
ESLint (TypeScript Only)
Expected configuration file: ./conf/eslint.mjs
make eslint
Stylelint
Expected configuration file: ./conf/stylelint.mjs
make stylelint
markdownlint
Expected configuration file: ./conf/markdownlint.mjs
make markdownlint
commitlint
Expected configuration file: ./conf/commitlint.mjs
make commitlint
IDE Setup
When using the recommended way of putting config files into the ./conf directory
it might be necessary to instruct your IDE to read these files correctly.
If you need a VS Code setup and have the specific extensions
installed you can take a look at the Project specific section in ./.vscode/settings.json.
🧩 Custom ESLint Rules
The default ESLint configuration ships a small brnshkr plugin that contributes a handful
of project-specific rules, all enabled out of the box. Each rule is documented with examples
in the Custom ESLint Rules docs.
🐘 PHP
🧰 Prerequisites
- PHP >= 8.5 (Older versions may work, but are untested)
- Composer >= 2.9 (Older versions may work, but are untested)
- PHP Extensions:
jsonmbstring
🚀 Installation
Composer
composer r --dev brnshkr/config
Take a look at the suggested packages in the composer.json file and install the ones
you need for the modules you want to use.
Copy the starter Makefile once, and let it write the rest:
cp -v ./vendor/brnshkr/config/conf/Makefile.dist ./Makefile \
&& make startup
make startup installs each stack, writes every config and .gitignore the project is missing, and never
touches a file that is already there.
To have the packages installed for you, pick the modules interactively:
composer brnshkr:config:setup
🎨 Custom
Take a look at the function signatures for exact details.
PHP CS Fixer
<?php // ./conf/php-cs-fixer.dist.php declare(strict_types=1); use Brnshkr\Config\PhpCsFixer; return PhpCsFixer::getConfig(/* customize */);
Rector
<?php // ./conf/rector.dist.php declare(strict_types=1); use Brnshkr\Config\Rector; return Rector::getConfig(/* customize */);
PHPStan
<?php // ./conf/phpstan.dist.php declare(strict_types=1); use Brnshkr\Config\PhpStan; return PhpStan::getConfig(/* customize */);
Twig CS Fixer
<?php // ./conf/twig-cs-fixer.dist.php declare(strict_types=1); use Brnshkr\Config\TwigCsFixer; return TwigCsFixer::getConfig(/* customize */);
👀 Usage
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)
PHP CS Fixer
Example call, adjust as needed
php ./vendor/bin/php-cs-fixer fix --config ./conf/php-cs-fixer.php -v --show-progress=dots
Rector
Example call, adjust as needed
php ./vendor/bin/rector process --config ./conf/rector.php --memory-limit=-1
PHPStan
Example call, adjust as needed
php ./vendor/bin/phpstan analyze --configuration ./conf/phpstan.php -vv --memory-limit=-1
Twig CS Fixer
Example call, adjust as needed
php ./vendor/bin/twig-cs-fixer fix --config ./conf/twig-cs-fixer.php -v
Option 2 — Run Make Targets (@brnshkr Convention)
For these targets to work you need to follow the convention of putting your configuration files into the ./conf directory
(Exactly how it is done in this project as well; see ./conf).
Your own Makefile includes this one. Copy the shipped starter rather than writing the include by hand:
it guards the include, so a fresh clone can make bootstrap before anything is installed.
cp -v ./vendor/brnshkr/config/conf/Makefile.dist ./Makefile
A target appears once the tool it runs is installed, so make help lists what your repository actually has,
make ci runs all of it, and make startup writes any config you are still missing.
The full reference is docs/Makefile.md.
PHP CS Fixer
Expected configuration file: ./conf/php-cs-fixer.php
make php-cs-fixer
Rector
Expected configuration file: ./conf/rector.php
make rector
PHPStan
Expected configuration file: ./conf/phpstan.php
make phpstan
Twig CS Fixer
Expected configuration file: ./conf/twig-cs-fixer.php
make twig-cs-fixer
IDE Setup
When using the recommended way of putting config files into the ./conf directory
it might be necessary to instruct your IDE to read these files correctly.
If you need a VS Code setup and have the specific extensions
installed you can take a look at the Project specific section in ./.vscode/settings.json.
Plugin Commands
Overview of all commands provided by the composer plugin.
For full usage run composer help <command>, composer <command> --help or composer <command> -h.
| Command | Alias | Description |
|---|---|---|
brnshkr:config |
b:c |
Displays the plugin overview and a list of available commands. Useful to quickly discover what the plugin exposes. |
brnshkr:config:update-php-extensions |
b:c:upe |
Scans installed packages and updates composer.json with required ext-* platform packages. |
brnshkr:config:extract-phar <package> |
b:c:ep |
Extracts a .phar file from a given vendor package. |
🧩 Custom PHPStan Rules
Beyond the upstream rule set, the default configuration ships a number of custom PHPStan rules in two flavors.
Standalone rules are general-purpose checks enabled out of the box,
while architecture presets are opinionated bundles of class-placement and isolation rules tailored to a
specific framework or architecture style — opt-in and configured through setArchitecture().
Both are documented with examples in the Custom PHPStan Rules docs.
🔨 TODOs / Roadmap
- Expand
⚙️ Workflowssection in readme - Add Vue support
- Add React support
- Add Tailwind support via https://github.com/schoero/eslint-plugin-better-tailwindcss
- Improve test setup
Any help is always greatly appreciated 🙂
❤️ Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the project
- Create your feature branch =>
git checkout -b feature/my-new-feature - Commit your changes =>
git commit -m 'feat(my-new-feature): add some awesome new feature' - Push to the branch =>
git push origin feature/my-new-feature - Open a pull request
New to the codebase? The Development docs cover environment setup and the day-to-day commands for both stacks.
💄 Commit Style
This project mostly follows the Conventional Commits specification.
There are only a few differences. The main one is that the scope is required:
So instead of this commit message signature: <type>[optional scope]: <description>
You should use this one: <type><scope>: <description>
Further details can be found in the commitlint configuration.
⚙️ Workflows
See ./.github/workflows for more information.
🔖 Versioning
This project follows Semantic Versioning 2.0.0.
The NPM and Composer packages are versioned in sync,
so a version change does not necessarily indicate a change in a specific package.
❗ Note ❗
Since changes to rules and dependencies are not considered breaking, even a patch release may introduce new errors in code that hasn't changed and break your CI without notice. We therefore strongly recommend pinning to an exact version (-Efor the JS package managers,composer r --dev brnshkr/config:X.Y.Zfor Composer) so updates stay opt-in and can be applied on your own schedule.
Changes Considered as Breaking Changes
- Version requirement changes of Node.js, Bun, PHP or Composer
- Changes that might break existing userland configs
Changes Considered as Non-Breaking Changes
- Changes regarding used rules and their options
- Version updates, introduction or removal of dependencies
- Updates of minimum required versions of optional dependencies
📃 License
Distributed under the MIT License. See LICENSE for more information.