Index

SshConfig

MMO\admin\helpers · 1 symbol · generated 5 Oct 2026

class

SshConfig

SshConfig.php:26

The bits of an ssh config a deployment needs, so a server can be declared as an ALIAS rather than as a host, a port, a user and a key path committed with the project.

class MMO\admin\helpers\SshConfig
Namespace
MMO\admin\helpers
The file is the project's own: [`FILENAME`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/helpers/SshConfig.md#sshconfig-filename), beside `deploy.json`, git-ignored and mode 0600 -- NOT the user's `~/.ssh/config`. Everything a project needs to deploy lives in the project folder; what cannot be shared is kept out of git there, not somewhere else on the machine. It is an ordinary ssh config, so `ssh -F deploy.ssh.config web1` reaches the server exactly as a deployment does. That indirection is the point. `"sshAlias": "ovh1"` in `deploy.json` is public information -- it says nothing about how you get in, only which entry of this machine's file to use. Two developers can reach the same target through different keys, ports or users without the committed declaration knowing, and there is no credential anywhere in the repository to leak. Deliberately a small subset: `Host`, `HostName`, `Port`, `User`, `IdentityFile`. `Include`, `Match`, and proxy/jump directives are NOT interpreted -- a target needing those should be reached through a plain `iShell` configured by hand ([`Server::$shell`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/entities/Server.md#server-shell)) rather than half-understood here.
$config = new SshConfig(SshConfig::DefaultFilename('/var/www/my.project')); $config->get('ovh1'); // ['hostname' => '...', 'port' => 60606, 'user' => 'ubuntu', ...]

Index

FILENAMEwhere a project keeps its ssh aliases: at its root, beside deploy.json.
filename
hosts
all()
debugName()
DefaultFilename($root) static
exists()
get($alias)
getFilename()
parse()
reload()Forget what was read: the next get reads the file again -- once setup has added an entry to it.
User() staticThe user's own ~/.ssh/config: never read to deploy, only offered by setup as a source to copy an alias from, into the project's file.
withHosts($hosts)
__construct($filename)

Constants1

FILENAME

where a project keeps its ssh aliases: at its root, beside deploy.json. init's .gitignore ignores it.

const FILENAME = 'deploy.ssh.config'

Properties2

filename

protected ?string $filename
Type
null | string

hosts

protected ?array $hosts = null
Type
null | array

Methods11

all()

SshConfig.php:73
function all(): array
returnsarrayalias => settings, for every literal (non-wildcard) Host entry.

DefaultFilename($root)

staticSshConfig.php:46
static function DefaultFilename(string $root): string
$rootstringthe project's folder -- the one holding deploy.json.
returnsstringwhere the project's ssh aliases live: FILENAME, in the project.

get($alias)

SshConfig.php:68
function get(string $alias): ?array
$aliasstringthe Host entry to look up.
returnsnull | arrayits settings (lowercased keys), or null when the file has no such entry.

reload()

SshConfig.php:89

Forget what was read: the next get reads the file again -- once setup has added an entry to it.

function reload(): void
returnsvoid

User()

staticSshConfig.php:55

The user's own ~/.ssh/config: never read to deploy, only offered by setup as a source to copy an alias from, into the project's file.

static function User(): ?static
returnsnull | staticnull when there is no home folder to look in.

withHosts($hosts)

SshConfig.php:82
function withHosts(array $hosts): static
$hostsarrayalias => settings (lowercased keys), over what the file says.
returnsstatica copy that also knows $hosts: what setup is about to write, before it is written.

__construct($filename)

SshConfig.php:36
function __construct(?string $filename = null)
$filename = nullnull | stringthe file to read (null: none -- every alias is unknown).