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, markdownlintignore
- testing : phpunit
- hooks : git hooks of laravel-dev-tools (core.hooksPath)
- 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
The public methods are the entry points of the publication, one per publishable asset. The work is done by three classes: BaseFilesPublisher (Makefile, .editorconfig, .gitignore, Composer scripts), ToolConfigPublisher (the configuration of the tools) and PlatformFilesPublisher (GitLab CI and governance files).
Source: src/Services/ConfigStubPublisher.php
Methods
__construct()
php
public function __construct(PublishOutput $output)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): boolSee ToolConfigPublisher::publishBaseline().
publishByKey()
php
public function publishByKey(string $key, string $vendorPath, string $basePath, bool $force, bool $fullstack = false): boolPublish a single file by its key name.
| Parameter | Description |
|---|---|
$key | One of: phpstan, rector, insights, baseline, pint, markdownlint, markdownlintignore, 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): voidSee ToolConfigPublisher::publishEnlightn().
publishGitlabCi()
php
public function publishGitlabCi(string $vendorPath, string $basePath, bool $force): boolSee PlatformFilesPublisher::publishGitlabCi().
publishGitlabCiFullstack()
php
public function publishGitlabCiFullstack(string $vendorPath, string $basePath, bool $force): boolSee PlatformFilesPublisher::publishGitlabCiFullstack().
publishGovernanceFiles()
php
public function publishGovernanceFiles(string $vendorPath, string $basePath, bool $force): boolSee PlatformFilesPublisher::publishGovernanceFiles().
publishGroup()
php
public function publishGroup(string $group, string $vendorPath, string $basePath, bool $force, bool $fullstack = false): 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): boolActivate the git hooks of laravel-dev-tools (core.hooksPath): they are read in place, nothing is published.
publishInsights()
php
public function publishInsights(string $vendorPath, string $basePath, bool $force): boolSee ToolConfigPublisher::publishInsights().
publishMarkdownlint()
php
public function publishMarkdownlint(string $vendorPath, string $basePath, bool $force): boolSee ToolConfigPublisher::publishMarkdownlint().
publishMarkdownlintIgnore()
php
public function publishMarkdownlintIgnore(string $vendorPath, string $basePath, bool $force): boolSee ToolConfigPublisher::publishMarkdownlintIgnore().
publishPhpstan()
php
public function publishPhpstan(string $vendorPath, string $basePath, bool $force): boolSee ToolConfigPublisher::publishPhpstan().
publishPhpunit()
php
public function publishPhpunit(string $vendorPath, string $basePath, bool $force): boolSee ToolConfigPublisher::publishPhpunit().
publishPint()
php
public function publishPint(string $vendorPath, string $basePath, bool $force = false): boolSee ToolConfigPublisher::publishPint().
publishRector()
php
public function publishRector(string $vendorPath, string $basePath, bool $force): boolSee ToolConfigPublisher::publishRector().
publishTarget()
php
public function publishTarget(string $target, string $vendorPath, string $basePath, bool $force, bool $fullstack = false): boolPublish a group or a key, as --publish=<target> says. The one entry of the two commands (Artisan and the shell setup).
| Parameter | Description |
|---|---|
$target | A group, or a key (phpstan-baseline is the old name of baseline) |
$fullstack | Publish the CI file of a project with PHP and JS |
Returns bool false for an unknown target (a file left alone is not an error)
wantsFullstack()
php
public function wantsFullstack(string $basePath, bool $asked = false): boolSee PlatformFilesPublisher::wantsFullstack().