Appearance
StubWriter
php
final class Zairakai\LaravelDevTools\Services\StubWriterWrites a file of the package in a project: a file that equals the stub is refreshed, one that differs is left alone, and --force replaces it after a copy in .dev-tools-backup/.
Source: src/Services/StubWriter.php
Methods
__construct()
php
public function __construct(PublishOutput $output)ensureDirectory()
php
public function ensureDirectory(string $directory): voidCreate the given directory recursively if it does not already exist.
publish()
php
public function publish(string $basePath, string $stubFile, string $targetFile, bool $force, string $label): boolCore workflow for copying a stub file to its target location.
| Parameter | Description |
|---|---|
$stubFile | Absolute path to the stub file |
$targetFile | Absolute path to the target file |
$force | Whether to overwrite an existing file |
$label | Human-readable label for console output |
saveBeforeOverwriting()
php
public function saveBeforeOverwriting(string $basePath, string $file): boolKeeps a copy of a file that a forced publication is about to write over, in .dev-tools-backup/ (the same folder as the shell scripts use). Nothing is kept when the file does not exist.
skip()
php
public function skip(string $label, string $reason, string $color = 'yellow'): voidDisplay a skipped-file message in the console.