PHPackages                             ario-labs/php-talos - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ario-labs/php-talos

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ario-labs/php-talos
===================

An expressive PHP SDK for Talos (talosctl) with a focus on simplicity and ease of use.

v1.1.3(10mo ago)07MITPHPPHP ^8.3.0CI passing

Since Aug 31Pushed 10mo agoCompare

[ Source](https://github.com/ario-labs/php-talos)[ Packagist](https://packagist.org/packages/ario-labs/php-talos)[ RSS](/packages/ario-labs-php-talos/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (9)Versions (6)Used By (0)

PHP Talos SDK
=============

[](#php-talos-sdk)

[![CI](https://github.com/ario-labs/php-talos/actions/workflows/ci.yml/badge.svg)](https://github.com/ario-labs/php-talos/actions/workflows/ci.yml)[![PHP](https://camo.githubusercontent.com/b155d1fbfe7022677ed4dac5b73cf38ed7a068a12e20c5d58dacb684e872a428/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d3737376262333f6c6f676f3d706870)](https://camo.githubusercontent.com/b155d1fbfe7022677ed4dac5b73cf38ed7a068a12e20c5d58dacb684e872a428/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d3737376262333f6c6f676f3d706870)[![Talos](https://camo.githubusercontent.com/b1d239db0efed87d362b26a1027fba5e2cec0c39628cc4a685f8d30e21ac427c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54616c6f732d76312e313025323025324225323076312e392d306561356539)](https://camo.githubusercontent.com/b1d239db0efed87d362b26a1027fba5e2cec0c39628cc4a685f8d30e21ac427c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54616c6f732d76312e313025323025324225323076312e392d306561356539)[![License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)[![Coverage](https://camo.githubusercontent.com/be5f72de56dd72676dfb2e83c599f99d1a2c23ee4b312da2ac2a966a62b2c1fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d3130302532352d73756363657373)](https://camo.githubusercontent.com/be5f72de56dd72676dfb2e83c599f99d1a2c23ee4b312da2ac2a966a62b2c1fa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d3130302532352d73756363657373)[![Packagist Version](https://camo.githubusercontent.com/9efa95c340dcfade368b7a4a555244dd338869e18d801fa288a6500e43ccf01a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6172696f2d6c6162732f7068702d74616c6f732e737667)](https://packagist.org/packages/ario-labs/php-talos)[![Total Downloads](https://camo.githubusercontent.com/2806af5c9be0560a2ec469f3e16b30f39f62d301f38a650a5887a4adedb47158/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6172696f2d6c6162732f7068702d74616c6f732e737667)](https://packagist.org/packages/ario-labs/php-talos)

An expressive, fluent PHP SDK for generating and managing [Talos](https://www.talos.dev) machine configurations via `talosctl`. Built with a Laravel-inspired API, strong typing, and a focus on delightful DX.

- Fluent builder for common Talos configuration (networking, control plane, etc.).
- First-class secrets workflow (generate → store → regenerate on demand).
- Structured YAML patching with precedence controls.
- Mandatory integration validation with `talosctl validate` (CI-ready).

> Package: `ario-labs/php-talos`

Why Talos?
----------

[](#why-talos)

[Talos](https://www.talos.dev) is a modern, immutable, minimal Linux distribution purpose‑built to run Kubernetes. It replaces SSH and many traditional OS subsystems with a declarative, API‑driven management plane. Pairing Talos with a fluent SDK makes it natural to:

- Generate safe, versioned machine configs per environment
- Validate those configs against multiple Talos versions in CI
- Regenerate secrets/configs on the fly for ephemeral or long‑lived clusters

Requirements
------------

[](#requirements)

- PHP 8.3+
- `talosctl` available in PATH for integration validation and secrets generation

Install
-------

[](#install)

```
composer require ario-labs/php-talos
```

Quick Start
-----------

[](#quick-start)

```
use ArioLabs\Talos\TalosFactory;
use ArioLabs\Talos\Builders\ClusterBuilder;
use ArioLabs\Talos\Enums\Cni;

$talos = (new TalosFactory(['log' => false]))->for();

$builder = new ClusterBuilder(
    talos: $talos,
    cluster: 'demo',
    endpoint: 'https://10.255.0.50:6443',
    // outDir is optional; prefer in-memory + writeTo() or use generateTo($dir)
);

$dir = $builder
    ->network(
        dns: 'cluster.local',
        pod: ['10.42.0.0/16'],
        svc: ['10.43.0.0/16'],
        nameservers: ['10.40.0.1'],
        interfaces: [[
            'name' => 'eth0',
            'addresses' => ['10.255.0.50/24'],
            'routes' => [['network' => '0.0.0.0/0', 'gateway' => '10.255.0.1']],
        ]],
    )
    ->cni(Cni::Flannel)
    ->additionalSans(['demo.local', '10.255.0.50'])
    ->manifests(['https://example.com/addons.yaml'])
    ->generateTo(sys_get_temp_dir().'/talos-demo-'.uniqid());

// Apply to a node (example)
$talos->nodes(['10.255.0.50'])->applyConfig($dir.'/controlplane.yaml', insecure: true);
// Fetch kubeconfig
$kubeconfigPath = $talos->endpoints(['10.255.0.50'])->kubeconfig();
```

Secrets Workflow (Generate → Store → Regenerate)
------------------------------------------------

[](#secrets-workflow-generate--store--regenerate)

Generate Talos secrets once, store them securely (e.g., encrypt in DB), and regenerate machine configs on demand without keeping config files on disk.

```
use ArioLabs\Talos\TalosSecrets;

$talos = (new TalosFactory(['log' => false]))->for();

// 1) Generate secrets
$secrets = $talos->genSecrets();

// 2) Serialize for storage (encrypt this in your app)
$payload = $secrets->toBase64Json();

// ... later: retrieve and decrypt
$secrets = TalosSecrets::fromBase64Json($payload);

// 3) Regenerate configs with secrets
$builder = new ClusterBuilder($talos, 'demo', 'https://10.255.0.50:6443');
$dir = $builder
    ->secrets($secrets)
    ->network(dns: 'cluster.local', pod: ['10.42.0.0/16'], svc: ['10.43.0.0/16'])
    ->generate();
```

### In‑Memory Generation

[](#inmemory-generation)

Obtain the generated YAML as strings, and only write to disk if/when you need to persist or apply them later. Under the hood, this uses a temporary directory to invoke `talosctl gen config`, applies your patches, then cleans up. Requires `talosctl` in PATH; errors from `talosctl` bubble as `ArioLabs\\Talos\\Exceptions\\CommandFailed`, and a `RuntimeException` is thrown if expected files are not produced.

```
use ArioLabs\Talos\Builders\ClusterBuilder;
use ArioLabs\Talos\GeneratedConfigs;

$builder = new ClusterBuilder($talos, 'demo', 'https://10.255.0.50:6443');

$configs = $builder
    ->secrets($secrets)
    ->network(dns: 'cluster.local', pod: ['10.42.0.0/16'], svc: ['10.43.0.0/16'])
    ->generateInMemory();

// YAML strings
$controlplaneYaml = $configs->controlplane();
$workerYaml = $configs->worker();

// Optionally persist later
$out = sys_get_temp_dir().'/talos-out-'.uniqid();
$configs->writeTo($out);

// Also get an in-memory talosconfig (not persisted; uses a temp dir under the hood)
// If you've set secrets($secrets) on the builder, this talosconfig is derived from those
// secrets so its CA/client certs match the cluster.
$talosconfig = $builder->talosconfigInMemory();
```

### Laravel Workflow (Secrets → In‑Memory Configs → talosconfig)

[](#laravel-workflow-secrets--inmemory-configs--talosconfig)

Below is an example of the intended application flow when using this package inside a Laravel app. Secrets are generated once, encrypted and stored by your app, and later used to regenerate configs and a talosconfig entirely in memory.

```
use ArioLabs\Talos\TalosFactory;
use ArioLabs\Talos\TalosSecrets;
use ArioLabs\Talos\Builders\ClusterBuilder;

// 1) Generate secrets and store (encrypt before saving)
$talos = (new TalosFactory(['log' => false]))->for();
$secrets = $talos->genSecrets();
$payload = $secrets->toBase64Json(); // encrypt this string with app key, store in DB

// ... later in a request/job: load + decrypt
$secrets = TalosSecrets::fromBase64Json($payload);

// 2) Regenerate configs in memory
$builder = new ClusterBuilder($talos, 'demo', 'https://10.255.0.50:6443');
$configs = $builder
    ->secrets($secrets)
    ->network(dns: 'cluster.local', pod: ['10.42.0.0/16'], svc: ['10.43.0.0/16'])
    ->generateInMemory();

$controlplaneYaml = $configs->controlplane();
$workerYaml = $configs->worker();

// 3) Obtain a talosconfig (in memory) for subsequent operations
$talosconfig = $builder->talosconfigInMemory();

// Optionally persist if needed
$dir = storage_path('talos/'.uniqid());
$configs->writeTo($dir);
file_put_contents($dir.'/talosconfig', $talosconfig);
```

Fluent Builder Reference
------------------------

[](#fluent-builder-reference)

- Network &amp; CNI
    - `network(?string $dns, array $pod, array $svc, array $nameservers, array $interfaces)`
    - `cni(Cni $cni)` → emits `cluster.network.cni: { name: ... }`
- Names &amp; SANs
    - `additionalSans(array $sans)` → CLI flag `--additional-sans=...`
- Manifests
    - `manifest(string $url)` / `manifests(array $urls)` (unique, accumulative)
- Machine networking
    - `nameservers(array $ips)`
    - `staticInterface(string $name, array $addresses, array $routes = [], bool $dhcp = false)`
- Install
    - `installDiskSelector(array $selector)`
    - `installWipe(bool $wipe = true)`
- Control plane
    - `apiServerImage(string $image)` / `apiServerArgs(array $args)` / `apiServerCertSANs(array $sans)`
    - `controllerManagerArgs(array $args)`
    - `schedulerArgs(array $args)` / `schedulerConfig(array $config)`
- etcd
    - `etcdAdvertisedSubnets(array $cidrs)` / `etcdExtraArgs(array $args)`
- Patching &amp; helpers
    - `set(string $dotPath, scalar|array|null $value)` → deep merge via dot path
    - `patchBoth(array $patch)` → merge into both machine configs
    - `patchFile(string $relativeYaml, array $patch)` → per-file overrides
- Secrets
    - `secrets(TalosSecrets $secrets)` → injects cluster/machine secrets
    - `generateInMemory()` → returns `GeneratedConfigs` (uses a temp dir internally; throws on failure)
    - `talosconfigInMemory(array $flags = [])` → return talosconfig content as a string
    - `generateTo(string $dir)` → generate configs to a specific directory
    - Constructor `outDir` is optional; if omitted, `generate()` uses a temp directory

Patching Precedence
-------------------

[](#patching-precedence)

1. Generated configs (with or without secrets)
2. Machine-level patches (from builder helpers: network, control plane, etc.) applied to both `controlplane.yaml` and `worker.yaml`
3. `patchFile()` per-file overrides last

Integration Validation (talosctl)
---------------------------------

[](#integration-validation-talosctl)

This project enforces validation via `talosctl validate`:

```
# Validate generated machine configs
talosctl validate -c controlplane.yaml --mode metal
talosctl validate -c worker.yaml       --mode metal
```

Our CI matrix runs validation against Talos current and prior minor versions.

Laravel Integration
-------------------

[](#laravel-integration)

- The SDK ships with a service provider and a simple factory.
- In Laravel, publish config as needed and bind `TalosFactory` from the container.
- Secrets are easy to store: `TalosSecrets::toBase64Json()` → encrypt with app key → save. Regenerate configs with `secrets()` on demand.

Testing
-------

[](#testing)

- Unit + Feature tests: 100% coverage, semantic YAML assertions (no brittle substrings).
- Integration tests: `talosctl validate` is required and runs in CI across versions.

Run locally:

```
composer test
```

Version Support &amp; CI
------------------------

[](#version-support--ci)

- PHP: 8.3, 8.4
- Talos: current (v1.10.x) + prior (v1.9.x) in CI

MatrixPHPTalosCI8.3, 8.4v1.10.7, v1.9.6SemVer &amp; 1.0.0
------------------

[](#semver--100)

- Pre‑1.0 breaking changes may occur; the current API is frozen for 1.0.0.
- After 1.0.0, standard SemVer applies.

Contributing
------------

[](#contributing)

- Run the full suite locally: `composer test`
- Follow the fluent API style for new helpers.
- Integration tests require `talosctl` in PATH (see CI matrix versions).
- Please include feature tests that read like usage examples.

Changelog
---------

[](#changelog)

All notable changes will be documented in [CHANGELOG.md](CHANGELOG.md) after 1.0.0. Prior to 1.0.0, see Git history and PRs.

License
-------

[](#license)

MIT

---

If you have ideas for presets (e.g., `ciliumPreset()`), open an issue — the fluent API makes it easy to add joyful one-liners that stay strictly type-safe.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance54

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

305d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13221930?v=4)[narellano](/maintainers/narellano)[@narellano](https://github.com/narellano)

---

Top Contributors

[![nickarellano](https://avatars.githubusercontent.com/u/13930605?v=4)](https://github.com/nickarellano "nickarellano (8 commits)")

---

Tags

phptalos

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ario-labs-php-talos/health.svg)

```
[![Health](https://phpackages.com/badges/ario-labs-php-talos/health.svg)](https://phpackages.com/packages/ario-labs-php-talos)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[illuminate/process

The Illuminate Process package.

44869.2k99](/packages/illuminate-process)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
