Centralized collection of configuration and tooling used across all @brnshkr projects.
☄️ Bug Reports / Feature Requests »
- 👋 About the Project
- ☕ 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.
- Node.js >= v24 or Bun >= v1.3 (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/configThis repository currently only provides one way to integrate configuration files (An automatic setup is planned, See 🔨 TODOs / Roadmap):
- Manual setup by copying the example configuration files yourself
Take a look at the peerDependencies in the 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:
cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.jsoncp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjscp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjscp -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.mjsTake a look at the function signatures for exact details.
// ./eslint.config.mjs
import { getConfig } from '@brnshkr/config/eslint';
export default getConfig(/* customize */);// ./stylelint.config.mjs
import { getConfig } from '@brnshkr/config/stylelint';
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.config.mjs --cache --cache-location ./.cache/eslint.cache.jsonExample call, adjust as needed
bun stylelint --config ./conf/stylelint.config.mjs --cache --cache-location ./.cache/stylelint.cache.json **/*.{css,ejs,html,less,postcss,scss,svelte,svg,vue}For these scripts 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).
Expected configuration file: ./conf/eslint.config.ts
bun ./node_modules/@brnshkr/config/dist/scripts/eslint.mjsExpected configuration file: ./conf/stylelint.config.mjs
bun ./node_modules/@brnshkr/config/dist/scripts/stylelint.mjsWhen 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 installed you can take a look at the Project specific section in ./.vscode/settings.json.
Install dependencies and setup git hooks:
bun install \
&& bun install-hooksWe recommend using the scripts provided in the package.json file as the primary way of running common tasks.
Have a look yourself for a full list of available targets.
Here are some frequently used examples:
bun lint— Run ESLint, Stylelint and Commitlintbun inspect:eslint— Inspect ESLint configurationbun check— Run TypeScript checks, linters and Vitestbun run test— Run Vitest test suitebun test-update— Run Vitest test suite and update snapshotsbun run build— Build the project and generate typesbun watch— Build the project in watch mode
- PHP >= 8.5 (Older versions may work, but are untested)
- Composer >= 2.9 (Older versions may work, but are untested)
- PHP Extensions:
jsonmbstring
composer req --dev brnshkr/configThis repository provides two ways to integrate configuration files and setup tools into your project:
- Automatic setup via the Composer plugin
- Manual setup by copying the example configuration files yourself
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:setupRun the automatic setup with all flags enabled:
composer brnshkr:config:setup -gofacmeTake a look at the plugin commands section to see a full list of available commands.
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.
You can then copy the specific configs to your project:
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.phpcp -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.phpcp -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.phpcp -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.phpcp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefilecp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignorecp -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 ./.gitignoreTake a look at the function signatures for exact details.
// ./php-cs-fixer.dist.php
<?php
declare(strict_types=1);
use Brnshkr\Config\PhpCsFixer;
return PhpCsFixer::getConfig(/* customize */);// ./rector.dist.php
<?php
declare(strict_types=1);
use Brnshkr\Config\Rector;
return Rector::getConfig(/* customize */);// ./phpstan.dist.php
<?php
declare(strict_types=1);
use Brnshkr\Config\PhpStan;
return PhpStan::getConfig(/* customize */);// ./twig-cs-fixer.dist.php
<?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 scripts 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).
Do not forget to setup your Makefile with this projects Makefile as a base:
include ./vendor/brnshkr/config/conf/MakefileExpected 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 neccesary to instruct your IDE to read these files correctly.
If you need a VSCode 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:setup [<modules>...] |
b:c:s |
Interactive setup helper: installs suggested packages for modules, copies example config files, and can create a Makefile and/or a .gitignore file. |
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. |
Install dependencies and setup project tooling with the following commands and adjust as needed:
composer install \
&& cp -v ./conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php \
&& cp -v ./conf/rector.php.example ./conf/rector.php \
&& cp -v ./conf/phpstan.php.example ./conf/phpstan.php \
&& cp -v ./conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.phpWe recommend using GNU Make as the primary task runner.
See the Makefile for a full list of available targets.
You can also run make help or simply make to view all targets with brief descriptions.
If you need local overrides, create a ./.local/Makefile — the main Makefile automatically includes it if present.
Here are some frequently used examples (see make help for the complete list):
make help— Show available targets and usagemake rector— Run Rector to apply automated PHP refactoringsmake php-cs-fixer— Run PHP-CS-Fixer to format and fix coding-style issuesmake phpstan— Run PHPStan static analysismake test— Run PHPUnit test suitemake test-update— Run PHPUnit test suite and update snapshotsmake check— Run Rector, PHP-CS-Fixer, Twig-CS-Fixer, PHPStan and PHPUnit
- Add setup command for JS package (like
composer brnshkr:config:setup) - Expand
⚙️ Worflowssection in readme - Write sections about custom PHPStan and ESLint rules
- Add all around support for enforcing TypeScript aliases with ESLint
- 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
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.
Also please note the following additional information:
- 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.