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 v0.2.0 โ”‚ .sputnik.dist.neon โ”‚ local

โ–ธ example ยท An example task to get you started

Hello, World!
โœ“ Done (0.00s)
  Greeted World

The exact version string depends on the release you are running. The overall output format stays the same.

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->shell('echo "Hello from Sputnik!"');

        return TaskResult::success();
    }
}

Run it:

php sputnik.phar greet

Next steps