Skip to content

Quick Start

Initialize a project

php sputnik.phar init

This creates:

  • .sputnik.dist.neon -- your project configuration
  • sputnik/ExampleTask.php -- a sample task to get started

Run the example task

php sputnik.phar example
Sputnik 0.1.0 │ .sputnik.dist.neon │ local

▸ example · An example task to get you started

Hello, World!
✓ Done (0.00s)
  Greeted World

Create your own task

Create a PHP file in your task directory (default: sputnik/):

<?php

declare(strict_types=1);

use Sputnik\Attribute\Task;
use Sputnik\Task\TaskContext;
use Sputnik\Task\TaskInterface;
use Sputnik\Task\TaskResult;

#[Task(
    name: 'greet',
    description: 'Say hello',
)]
final class GreetTask implements TaskInterface
{
    public function __invoke(TaskContext $ctx): TaskResult
    {
        $ctx->shellRaw('echo "Hello from Sputnik!"');

        return TaskResult::success();
    }
}

Run it:

php sputnik.phar greet

Next steps