Appearance
ConfigStubPublisher
php
final readonly class Zairakai\LaravelDevTools\Services\ConfigStubPublisherPublishes configuration stubs from the vendor package into the project.
Handles force overwrites, protects user-modified files, and provides console feedback for each operation.
Publishing groups:
- quality : phpstan, rector, insights, baseline
- style : pint, markdownlint
- testing : phpunit
- hooks : .githooks/ directory
- gitlab-ci : .gitlab-ci.yml (opt-in, not in 'all')
- governance : CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md (opt-in, not in 'all')
- all : all groups above except gitlab-ci and governance
Each public method corresponds to one publishable asset — intentional by design. Splitting into sub-publishers would add indirection without benefit.
Source: src/Services/ConfigStubPublisher.php
Methods
__construct()
php
public function __construct(Factory $componentsFactory)availableGroups()
php
public function availableGroups(): arrayReturns valid publishable group names.
Returns array<int, string>
availableKeys()
php
public function availableKeys(): arrayReturns valid publishable individual key names.
Returns array<int, string>
publishBaseline()
php
public function publishBaseline(string $vendorPath, string $basePath): boolPublish the PHPStan baseline stub. Never force-overwritten — it accumulates user-accepted errors.
publishByKey()
php
public function publishByKey(string $key, string $vendorPath, string $basePath, bool $force): boolPublish a single file by its key name.
| Parameter | Description |
|---|---|
$key | One of: phpstan, rector, insights, baseline, pint, markdownlint, phpunit, hooks |
$vendorPath | Absolute path to the vendor package root |
$basePath | Absolute path to the project root |
$force | Overwrite existing files if true |
publishEnlightn()
php
public function publishEnlightn(string $vendorPath, string $basePath, bool $force): voidPublish the Enlightn configuration stub. Not part of any group — installed automatically on first setup.
publishGitlabCi()
php
public function publishGitlabCi(string $vendorPath, string $basePath, bool $force): boolPublish the GitLab CI pipeline stub (.gitlab-ci.yml) into the project root.
publishGitlabCiFullstack()
php
public function publishGitlabCiFullstack(string $vendorPath, string $basePath, bool $force): boolPublish the full-stack GitLab CI pipeline stub (.gitlab-ci.yml) into the project root.
publishGovernanceFiles()
php
public function publishGovernanceFiles(string $vendorPath, string $basePath, bool $force): boolPublish governance files (CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md) to project root.
publishGroup()
php
public function publishGroup(string $group, string $vendorPath, string $basePath, bool $force): boolPublish all files belonging to the given group.
| Parameter | Description |
|---|---|
$group | One of: quality, style, testing, hooks, all |
$vendorPath | Absolute path to the vendor package root |
$basePath | Absolute path to the project root |
$force | Overwrite existing files if true |
publishHooks()
php
public function publishHooks(string $vendorPath, string $basePath, bool $force): boolPublish git hooks stubs into .githooks/ directory.
publishInsights()
php
public function publishInsights(string $vendorPath, string $basePath, bool $force): boolPublish the PHP Insights configuration stub. User is expected to customize this file — protected against force overwrite.
publishMarkdownlint()
php
public function publishMarkdownlint(string $vendorPath, string $basePath, bool $force): boolPublish the Markdownlint configuration into config/dev-tools/.
publishPhpstan()
php
public function publishPhpstan(string $vendorPath, string $basePath, bool $force): boolPublish the PHPStan config (library.neon) into config/dev-tools/.
publishPhpunit()
php
public function publishPhpunit(string $vendorPath, string $basePath, bool $force): boolPublish the PHPUnit configuration stub. Detects project type to choose between app and package config.
publishPint()
php
public function publishPint(string $vendorPath, string $basePath, bool $force): boolPublish the Pint configuration into config/dev-tools/.
publishRector()
php
public function publishRector(string $vendorPath, string $basePath, bool $force): boolPublish the Rector configuration stub. User is expected to customize this file — protected against force overwrite.