Centralized collection of configuration and tooling used across all @brnshkr projects.
☄️ Bug Reports / Feature Requests »
- 👋 About the Project
- 📚 Documentation
- ☕ JS
- 🐘 PHP
- 🔨 TODOs / Roadmap
- ❤️ Contributing
- 🔖 Versioning
- 📃 License
- 🌐 Acknowledgments
@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.
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.
- Node.js >= v24.15 or Bun >= v1.4 (Older versions may work, but are untested)
- Any JavaScript package manager (Bun, Yarn, PNPM, NPM)
bun a -D -E @brnshkr/configyarn add -D -E @brnshkr/configpnpm add -D -E @brnshkr/confignpm i -D -E @brnshkr/configTake 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 startupmake startup installs each stack, writes every config and .gitignore the project is missing, and never
touches a file that is already there.
Take a look at the function signatures for exact details.
// ./conf/eslint.mjs
import { getConfig } from '@brnshkr/config/eslint';
export default getConfig(/* customize */);// ./conf/stylelint.mjs
import { getConfig } from '@brnshkr/config/stylelint';
export default getConfig(/* customize */);// ./conf/markdownlint.mjs
import { getConfig } from '@brnshkr/config/markdownlint';
export default getConfig(/* customize */);// ./conf/commitlint.mjs
import { getConfig } from '@brnshkr/config/commitlint';
export default getConfig(/* customize */);// ./conf/vitest.mjs
import { getConfig } from '@brnshkr/config/vitest';
export default getConfig(/* customize */);This package provides configurations, not a hard requirement on how you run tools.
A few possible ways are listed below:
Example call, adjust as needed
bun eslint --config ./conf/eslint.mjs --cache --cache-location ./.cache/eslint.cache.json --max-warnings 0Example 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}"Example call, adjust as needed
bun markdownlint-cli2 --config ./conf/markdownlint.mjs "**/*.md"Example call, adjust as needed
bun commitlint --config ./conf/commitlint.mjs --editFor 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 ./MakefileA 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.
Expected configuration file: ./conf/eslint.mjs
make eslintExpected configuration file: ./conf/stylelint.mjs
make stylelintExpected configuration file: ./conf/markdownlint.mjs
make markdownlintExpected configuration file: ./conf/commitlint.mjs
make commitlintWhen 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.
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 >= 8.5 (Older versions may work, but are untested)
- Composer >= 2.9 (Older versions may work, but are untested)
- PHP Extensions:
jsonmbstring
composer r --dev brnshkr/configTake 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 startupmake 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:setupTake a look at the function signatures for exact details.
<?php
// ./conf/php-cs-fixer.dist.php
declare(strict_types=1);
use Brnshkr\Config\PhpCsFixer;
return PhpCsFixer::getConfig(/* customize */);<?php
// ./conf/rector.dist.php
declare(strict_types=1);
use Brnshkr\Config\Rector;
return Rector::getConfig(/* customize */);<?php
// ./conf/phpstan.dist.php
declare(strict_types=1);
use Brnshkr\Config\PhpStan;
return PhpStan::getConfig(/* customize */);<?php
// ./conf/twig-cs-fixer.dist.php
declare(strict_types=1);
use Brnshkr\Config\TwigCsFixer;
return TwigCsFixer::getConfig(/* customize */);This package provides configurations, not a hard requirement on how you run tools.
A few possible ways are listed below:
Example call, adjust as needed
php ./vendor/bin/php-cs-fixer fix --config ./conf/php-cs-fixer.php -v --show-progress=dotsExample call, adjust as needed
php ./vendor/bin/rector process --config ./conf/rector.php --memory-limit=-1Example call, adjust as needed
php ./vendor/bin/phpstan analyze --configuration ./conf/phpstan.php -vv --memory-limit=-1Example call, adjust as needed
php ./vendor/bin/twig-cs-fixer fix --config ./conf/twig-cs-fixer.php -vFor 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 ./MakefileA 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.
Expected configuration file: ./conf/php-cs-fixer.php
make php-cs-fixerExpected configuration file: ./conf/rector.php
make rectorExpected configuration file: ./conf/phpstan.php
make phpstanExpected configuration file: ./conf/twig-cs-fixer.php
make twig-cs-fixerWhen 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.
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. |
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.
- 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 🙂
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.
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.
See ./.github/workflows for more information.
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.
- Version requirement changes of Node.js, Bun, PHP or Composer
- Changes that might break existing userland configs
- Changes regarding used rules and their options
- Version updates, introduction or removal of dependencies
- Updates of minimum required versions of optional dependencies
Distributed under the MIT License. See LICENSE for more information.