brnshkr/config

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

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 11

Watchers: 1

Forks: 0

Open Issues: 0

Language:TypeScript

Type:composer-plugin

pkg:composer/brnshkr/config

0.0.1-alpha.4 2026-02-10 22:12 UTC

README

@brnshkr/config project logo

Semantic Versioning 2.0.0 MIT License Stars Forks Issues

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

☄️ Bug Reports / Feature Requests »

Table of Contents

   ⬆   

👋 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.

   ⬆   

☕ JS

🧰 Prerequisites

  • Node.js >= v24 or Bun >= 1.3 (Older versions may work, but are untested)
  • Any JavaScript package manager (Bun, Yarn, PNPM, NPM)

   ⬆   

🚀 Installation

Bun

bun a -D @brnshkr/config

Yarn

yarn add -D @brnshkr/config

PNPM

pnpm add -D @brnshkr/config

NPM

npm i -D @brnshkr/config

This 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

   ⬆   

✋ Manual

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:

TypeScript
cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.json
ESLint
cp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjs
Stylelint
cp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjs
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

   ⬆   

🎨 Custom

Take a look at the function signatures for exact details.

ESLint
// ./eslint.config.mjs

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

export default getConfig(/* customize */);
Stylelint
// ./stylelint.config.mjs

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

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.config.ts --cache --cache-location ./.cache/eslint.cache.json
Stylelint

Example 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}
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 directory (Exactly how it is done in this project as well).

ESLint (TypeScript Only)

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

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

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

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

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 installed you can take a look at the Project specific section in ./.vscode/settings.json.

   ⬆   

💻 Development

Setup

Install dependencies and setup git hooks:

bun install \
  && bun install-hooks

Scripts

We 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.

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

   ⬆   

🐘 PHP

🧰 Prerequisites

  • PHP >= 8.5 (Older versions may work, but are untested)
  • Composer >= 2.9 (Older versions may work, but are untested)
  • PHP Extensions:
    • json
    • mbstring

   ⬆   

🚀 Installation

Composer

composer req --dev brnshkr/config

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

🤖 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 section to see a full list of available commands.

   ⬆   

✋ Manual

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:

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.dist.php.example ./conf/.php-cs-fixer.dist.php
Rector
cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php \
  && cp -v ./vendor/brnshkr/config/conf/rector.dist.php.example ./conf/rector.dist.php
PHPStan
cp -v ./vendor/brnshkr/config/conf/phpstan.neon.example ./conf/phpstan.neon \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.dist.neon.example ./conf/phpstan.dist.neon
Makefile
cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile
Gitignore
cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore
All
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.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.dist.php.example ./conf/rector.dist.php \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.neon.example ./conf/phpstan.neon \
  && cp -v ./vendor/brnshkr/config/conf/phpstan.dist.neon.example ./conf/phpstan.dist.neon \
  && cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile \
  && cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore

   ⬆   

🎨 Custom

Take a look at the function signatures for exact details.

PHP CS Fixer
// ./.php-cs-fixer.dist.php

<?php

declare(strict_types=1);

use Brnshkr\Config\PhpCsFixerConfig;

return PhpCsFixerConfig::get(/* customize */);
Rector
// ./rector.php

<?php

declare(strict_types=1);

use Brnshkr\Config\RectorConfig;

return RectorConfig::get(/* customize */);
PHPStan
# phpstan.dist.neon

includes:
  - '%currentWorkingDirectory%/vendor/brnshkr/config/conf/phpstan.dist.neon'

# 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 -v --show-progress=dots --config ./conf/.php-cs-fixer.php
Rector

Example call, adjust as needed

php ./vendor/bin/rector process --config ./conf/rector.php
PHPStan

Example call, adjust as needed

php ./vendor/bin/phpstan analyze --memory-limit=-1 --configuration ./conf/phpstan.neon
Option 2 — Run Helper Scripts (Make Only, @brnshkr Convention)

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).

Do not forget to setup your Makefile with this projects Makefile as a base:

include ./vendor/brnshkr/config/conf/Makefile
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.neon

make phpstan

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 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: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.

   ⬆   

💻 Development

Setup

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.neon.example ./conf/phpstan.neon

Make

We 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.

Common targets

Here are some frequently used examples (see make help for the complete list):

  • make help — Show available targets and usage
  • make rector — Run Rector to apply automated PHP refactorings
  • make php-cs-fixer — Run PHP-CS-Fixer to format and fix coding-style issues
  • make phpstan — Run PHPStan static analysis
  • make test — Run PHPUnit test suite
  • make test-update — Run PHPUnit test suite and update snapshots
  • make check — Run Rector, PHP-CS-Fixer, PHPStan and PHPUnit

🔨 TODOs / Roadmap

  • Add setup command for JS package (like composer brnshkr:config:setup)
  • Expand ⚙️ Worflows section 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 🙂

   ⬆   

❤️ 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!

  1. Fork the project
  2. Create your feature branch => git checkout -b feature/my-new-feature
  3. Commit your changes => git commit -m 'feat(my-new-feature): add some awesome new feature'
  4. Push to the branch => git push origin feature/my-new-feature
  5. Open a pull request

💄 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.
Also please note the following additional information:

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.

   ⬆   

🌐 Acknowledgments

   ⬆