A PHP build automation tool using JSON configuration file.
- Overview
- Features
- Requirements
- Diagrams
- Installation
- Usage
- FAQ
- Support
- Changelog
- ToDo
- Contributing
- Code of Conduct
- DCO
- Contributors
- Notice
- License
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).
- 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
- PHP >= 8.3
- Composer >= 2
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
+--------------------+ +-------------------+
| 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)|
+-------------------------+
+-------------------+
| 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 |
+-------------------+
By Composer project-specific installation:
composer require --dev phpmake/phpmake
By Composer global installation:
composer global require phpmake/phpmake
-
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
Run tests to ensure everything works as expected:
composer test
Or
vendor/bin/phpunit tests/
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 |
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 |
See build.json.example file.
See FAQ.txt file.
For any question, issues and feature requests, open an issue..
See CHANGELOG.txt file.
See TODO.txt file.
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.
See CODE_OF_CONDUCT.txt file.
See DCO.txt file.
See CONTRIBUTORS.txt file.
See NOTICE.txt file.
This open-source software is distributed under the GPL-3.0 license. See LICENSE file.