KMP PHP API Reference

FileSecretStore
in package
implements WritableSecretStoreInterface

Table of Contents

Interfaces

WritableSecretStoreInterface

Properties

$allowInEnvironments  : array<string|int, mixed>
$environment  : string
$path  : string

Methods

__construct()  : mixed
delete()  : void
Delete a secret value.
exists()  : bool
Return true if a secret name exists without revealing or decrypting its value.
get()  : SensitiveString|null
Fetch a secret value.
list()  : array<int, string>
put()  : void
Store or replace a secret value.
rotatedAt()  : DateTimeImmutable|null
Return when a secret was last rotated, if known, without revealing the value.
assertDirectoryPermissions()  : void
Ensure the containing directory cannot be replaced by arbitrary users.
assertFilePermissions()  : void
Ensure the secrets file itself is not readable by group/world users.
preserveOwnership()  : void
Keep an atomic replacement readable by the same account as the current file.
readRecords()  : array<string, array<string, mixed>>
writeRecords()  : void

Properties

$allowInEnvironments read-only

private array<string|int, mixed> $allowInEnvironments = ['local', 'development', 'dev', 'test', 'ci']

Methods

__construct()

public __construct(string $path[, string $environment = 'local' ][, array<int, string> $allowInEnvironments = ['local', 'development', 'dev', 'test', 'ci'] ]) : mixed
Parameters
$path : string
$environment : string = 'local'
$allowInEnvironments : array<int, string> = ['local', 'development', 'dev', 'test', 'ci']

delete()

Delete a secret value.

public delete(string $name) : void
Parameters
$name : string

Secret name

Tags
inheritDoc

exists()

Return true if a secret name exists without revealing or decrypting its value.

public exists(string $name) : bool
Parameters
$name : string
Tags
inheritDoc
Return values
bool

list()

public list([string $prefix = '' ]) : array<int, string>
Parameters
$prefix : string = ''
Tags
inheritDoc
Return values
array<int, string>

Secret names only; never values.

rotatedAt()

Return when a secret was last rotated, if known, without revealing the value.

public rotatedAt(string $name) : DateTimeImmutable|null
Parameters
$name : string

Secret name

Tags
inheritDoc
Return values
DateTimeImmutable|null

assertDirectoryPermissions()

Ensure the containing directory cannot be replaced by arbitrary users.

private assertDirectoryPermissions(string $directory) : void
Parameters
$directory : string

Directory path

assertFilePermissions()

Ensure the secrets file itself is not readable by group/world users.

private assertFilePermissions() : void

preserveOwnership()

Keep an atomic replacement readable by the same account as the current file.

private preserveOwnership(string $path, int|null $owner, int|null $group) : void
Parameters
$path : string

Temporary replacement path.

$owner : int|null

Existing file owner.

$group : int|null

Existing file group.

readRecords()

private readRecords() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>

writeRecords()

private writeRecords(array<string, array<string, mixed>> $records) : void
Parameters
$records : array<string, array<string, mixed>>
On this page

Search results