Download the PHP package vjik/scaffolder without Composer
On this page you can find all versions of the php package vjik/scaffolder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package scaffolder
PHP Scaffolder Library
A PHP library for making automated changes to project files through a decision-based architecture.
Real-world examples of a scaffolder tool built using this library:
General Usage
[!NOTE] A ready-made scaffolder tool built on top of this library is available at vjik/scaffolder-template. This template provides a complete scaffolder framework that you can clone and customize for your projects.
The scaffolder allows you to automate project file modifications through a declarative approach. Create a PHP script that defines the changes you want to apply:
Run your script:
The scaffolder will execute each change in sequence, showing progress:
Architecture
Changes
Changes implement the Change interface and define what modifications to apply. Each change:
- Implements a
decide(Context $context): callable|array|nullmethod - Returns an "applier" callable to execute, or
nullfor no-op - Can inspect the current state and decide whether to apply
Built-in Changes:
WriteFile- Write content to a fileWriteFileIfNotExists- Write file only if it doesn't existCopyFile- Copy a fileCopyFileIfNotExists- Copy file only if it doesn't existPrepareComposerJson- Update composer.json with package informationEnsureDirectoryWithGitkeep- Ensure directory exists with .gitkeepEnsureFact- Ensure a fact is resolved (useful for prompting user input)ChangeIf- Conditionally apply changes based on a condition
Facts
Facts are template classes that resolve contextual information on-demand. They can:
- Read from files (e.g., existing
composer.json) - Prompt the user for input
- Derive values from other facts
- Add CLI options
Example:
Facts are lazily resolved and cached, so expensive operations only happen when needed.
Built-in Facts:
ComposerJson- Read and parse existing composer.jsonPackageName- Package name (e.g., "vendor/package")PackageVendor- Vendor name from package namePackageProject- Project name from package namePackageDescription- Package descriptionPackageLicense- Package licensePackageType- Package type (library, project, etc.)PackageAuthors- Array of package authorsNamespaceX- Root namespace (e.g., "Vendor\Package")SourceDirectory- Source code directory (default: "src")TestsDirectory- Tests directory (default: "tests")PhpConstraint- PHP version constraintPhpConstraintName- PHP constraint name (default: "php")LowestMinorPhpVersion- Lowest minor PHP versionHighestMinorPhpVersion- Highest minor PHP versionMinorPhpVersionRange- PHP version rangePrepareComposerAutoload- Whether to prepare autoload sectionPrepareComposerAutoloadDev- Whether to prepare autoload-dev sectionCopyrightHolder- Copyright holder nameCopyrightYear- Copyright yearTitle- Project titleUserName- User/author nameUserEmail- User/author email
Parameters
The scaffolder supports a flexible parameter system that allows configuration through multiple sources with a clear priority order:
- Command line options - facts can add their own CLI options
scaffolder.phpfile - project-specific configuration- Runner constructor - default values
Setting parameters via scaffolder.php file:
Create a scaffolder.php file in your project directory:
Setting default parameters via Runner:
Parameters from scaffolder.php will override runner defaults.
Command Line Options:
--directory- specify the target directory where changes will be applied (default: current working directory)--scaffolder-file- Specify custom name for the configuration file (default:scaffolder.php)
Documentation
If you have any questions or problems with this package, use author telegram chat for communication.
License
The vjik/scaffolder is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.
Credits
The package is inspired by phpyh/scaffolder code originally created by Valentin Udaltsov.
All versions of scaffolder with dependencies
ext-filter Version *
symfony/console Version ^8.0.3
symfony/filesystem Version ^8.0.1
composer/semver Version ^3.4.4
yiisoft/strings Version ^2.7