PHP task automation with actual structure
Sputnik¶
A PHP TaskRunner that lets you define project automation as clean, testable PHP classes. No YAML, no DSL -- just normal code with attributes.
Define tasks with options, arguments, and shell execution. Switch contexts for different environments. Route commands transparently between host and container. Distribute as a single PHAR file.
Get Started Installation GitHub
PHAR-first Context-aware Container routing PHP 8.3+
-
Normal PHP
Tasks are plain PHP classes. No YAML workflow language, no custom mini-language, no "magic function dump".
-
Project state built in
Contexts, variables, templates, listeners, and runtime state are part of the model instead of ad-hoc shell conventions.
-
CLI that matches real work
Designed for project builds, deploys, Docker workflows, context switching, and repeatable local automation.
#[Task(name: 'deploy', description: 'Deploy the application', environment: 'container')]
final class DeployTask implements TaskInterface
{
public function __invoke(TaskContext $ctx): TaskResult
{
$ctx->shell('rsync -avz ./dist/ {{ deployPath }}/');
$ctx->exec(['php', 'artisan', 'migrate', '--force']);
return TaskResult::success();
}
}
$ php sputnik.phar deploy
๐ฐ Sputnik v0.2.0 โ .sputnik.dist.neon โ prod
โธ deploy ยท Deploy the application
> rsync -avz ./dist/ /var/www/app/
> php artisan migrate --force
โ Done (1.24s)
Why teams pick Sputnik¶
-
Tasks
PHP classes with
#[Task]attributes. Options, arguments, and shell execution built in. -
Contexts
Named configurations with variable overrides. Switch with one command, no code changes.
-
Templates
Render files with
{{ variable }}syntax. Re-rendered automatically on context switch. -
Secrets
Variables Sputnik refuses to print. Masked in echoed commands, streamed output and log lines.
-
Environments
Transparent command routing between host and container via configurable executor.
Start here¶
-
Quick Start
Initialize a project and run your first task in under a minute.
-
Recipes
Practical patterns for builds, deploys, Docker, templates, and more.
-
CLI Reference
All commands, flags, and reserved names.
-
Releases
Release notes and PHAR downloads.
Fits best when¶
-
You want structure, not scripts everywhere
Shell snippets still exist, but they live inside typed PHP tasks with explicit options, arguments, and metadata.
-
You switch between dev, staging, and production a lot
Contexts and template regeneration make environment changes explicit instead of buried in copied commands.
-
You need one distributable binary
PHAR distribution keeps execution simple for teams and CI while Composer remains optional for editor support.