phpmake / phpmake
A PHP build automation tool using JSON configuration file.
Requires (Dev)
- ergebnis/composer-normalize: 2.47.*
- friendsofphp/php-cs-fixer: 3.75.*
- icanhazstring/composer-unused: 0.9.*
- maglnet/composer-require-checker: 4.16.*
- overtrue/phplint: 9.6.*
- phpunit/phpunit: 12.1.*
- rector/rector: 2.0.*
This package is auto-updated.
Last update: 2025-06-19 07:41:11 UTC
README
A PHP build automation tool using JSON configuration file.
Contents
- Overview
- Features
- Requirements
- Diagrams
- Installation
- Usage
- FAQ
- Support
- Changelog
- ToDo
- Contributing
- Code of Conduct
- DCO
- Contributors
- Notice
- License
Overview
A lightweight PHP-based build automation tool inspired by Linux Make & Apache Ant, using JSON configuration files. It supports common tasks like file operations, command execution, and dependency management with cross-platform compatibility (Windows/Linux/macOS).
Features
- Dependency-free: No dependency-hell and even dependency-free!
- JSON configuration: Define build processes in human-readable JSON
- Task dependencies: Specify execution order with dependencies
- Cross-platform: Works on Microsoft Windows & GNU+Linux
- Built-in tasks:
create_directory
(create directories)delete
(remove files/directories)copy
(file/directory copying)exec
(execute shell commands)echo
(output messages)archive
(archive/compress a file or directory)
- Logging options:
-d
/--debug
for detailed logs--no-log
to disable file logging-s
/--silent
for minimal output
- Validation:
--validate-build
to check configuration syntax - System diagnostics:
--diagnostics
to show environment info - DevOps ready: CI/CD pipeline integration
- Supported PHP: 7.4 & 8.3
- Supported platforms: Microsoft Windows, GNU+Linux, Apple MacOS
Requirements
- PHP >= 8.3
- Composer >= 2
Versions
Package version | Branch | PHP version | Status |
---|---|---|---|
dev-main | main |
8.3 | Active |
2.* | main |
8.3 | Active |
1.* | main-php7.4 |
7.4 | Active |
- Active: Full support
- Maintenance: Bug/Security fixes only
- EOL: Unsupported
Diagrams
Component diagram
+--------------------+ +-------------------+ | Build Configuration|<----+| CLI Parser | | (build.json schema)| | (Parses arguments)| +--------------------+-| +-------------------+ ^ | | | | v | | +-------------------+ | +->| Build Executor | | | (Runs targets) | | +-------------------+ | | | v | +---------------------+ +------------->| Task Factory | | (Instantiates tasks)| +---------------------+ | v +-----------------------------+ | Tasks (delete/copy/exec/...)| +-----------------------------+ | v +----------------------+ | Logger | | (Handles output/logs)| +----------------------+ ^ | +-------------------------+ | Validator | | (Checks config validity)| +-------------------------+
Workflow diagram
+-------------------+ | 1. CLI Input | | * Parse arguments | +-------v----------+ | 2. Load/Validate | | * Read build.json | | * Validate schema | +-------v----------+ | 3. Dependency | | Resolution | | * Determine order | +-------v----------+ | 4. Execute Tasks | | * Run tasks | | * Handle errors | +-------v----------+ | 5. Output Results | | * Show logs | | * Exit status | +-------------------+
Installation
By Composer project-specific installation:
composer require --dev phpmake/phpmake
By Composer global installation:
composer global require phpmake/phpmake
Usage
-
Create a
build.json
file:{ "name": "MyProject", "description": "Sample project build configuration", "version": "2.0.0", "targets": { "clean": { "tasks": [{ "type": "delete", "params": { "path": "build" } }] }, "build": { "depends": ["clean"], "tasks": [ { "type": "create_directory", "params": { "name": "build" } }, { "type": "copy", "params": { "source": "src/", "dest": "build/" } }, { "type": "exec", "params": { "command": "php compiler.php" } } ] } }, "default_target": "build" }
-
Run the builder:
For GNU+Linux:
chmod +x bin/phpmake.php
Then
vendor/bin/phpmake
Or
php vendor/bin/phpmake
Or
# Validate configuration. php vendor/bin/phpmake --validate # Run default target with debug logging. php vendor/bin/phpmake --debug
Or
# Run test target silently. php vendor/bin/phpmake test --silent
QA/QC test
Run tests to ensure everything works as expected:
composer test
Or
vendor/bin/phpunit tests/
Commands
Command | Description |
---|---|
phpmake |
Run default target |
phpmake <target> |
Run specific target |
phpmake --help |
Show help menu |
phpmake --version |
Show PHPMake version |
phpmake --validate |
Validate build file |
phpmake --diagnostics |
Show system information |
phpmake -d/--debug |
Enable debug/verbose logging |
phpmake -nl--no-log |
Disable file logging |
phpmake -s/--silent |
Suppress console output |
phpmake --init |
Create sample build.json file |
Supported tasks
Task type | Parameters | Description |
---|---|---|
create_directory |
name (string) |
Create directory |
delete |
path (string) |
Delete file/directory |
copy |
source (string), dest (string) |
Copy files/directories |
exec |
command (string) |
Execute shell command |
echo |
message (string) |
Output message |
archive |
dir (string) |
Archive a directory |
Example build file
See build.json.example file.
FAQ
See FAQ.txt file.
Support
For any question, issues and feature requests, open an issue..
Changelog
See CHANGELOG.txt file.
ToDo
See TODO.txt file.
Contributing
Contributions are welcome! Please follow these steps:
- Fork repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request with a detailed description of your changes.
For more details see CONTRIBUTING.txt.
Code of Conduct
See CODE_OF_CONDUCT.txt file.
DCO
See DCO.txt file.
Contributors
See CONTRIBUTORS.txt file.
Notice
See NOTICE.txt file.
License
This open-source software is distributed under the GPL-3.0 license. See LICENSE file.