Skip to content

Worked extension examples

These developer-facing recipes are kept beside the package contract. Replace the example values with the site-specific records and data objects used by the calling workflow.

<?php
declare(strict_types=1);
final class ExampleCompiledThemeReceiptSigningAuthorityImplementation implements \Capell\FoundationTheme\Contracts\CompiledThemeReceiptSigningAuthority
{
public function issuer(): string
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function keyId(): string
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function releaseIdentity(): string
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function notBefore(): \DateTimeImmutable
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function notAfter(): ?\DateTimeImmutable
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function sign(string $message): string
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function verify(string $message, string $signature): bool
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FoundationTheme\Contracts\CompiledThemeReceiptSigningAuthority::class, ExampleCompiledThemeReceiptSigningAuthorityImplementation::class);
<?php
declare(strict_types=1);
final class ExampleDesignSpecMigrationReaderImplementation implements \Capell\FoundationTheme\Contracts\DesignSpecMigrationReader
{
public function schemaVersion(): int
{
throw new LogicException('Implement this package contract for the calling site.');
}
/** @param array<string, mixed> $specification */
public function read(array $specification): \Capell\FoundationTheme\Data\DesignSpec\DesignSpecData
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FoundationTheme\Contracts\DesignSpecMigrationReader::class, ExampleDesignSpecMigrationReaderImplementation::class);
<?php
declare(strict_types=1);
final class ExampleInstallsThemeDemoImplementation implements \Capell\FoundationTheme\Contracts\InstallsThemeDemo
{
public function handle(\Capell\FoundationTheme\Data\ThemeDemoInstallData $data): int
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FoundationTheme\Contracts\InstallsThemeDemo::class, ExampleInstallsThemeDemoImplementation::class);
<?php
declare(strict_types=1);
final class ExampleOptionalExtensionAvailabilityImplementation implements \Capell\FoundationTheme\Contracts\OptionalExtensionAvailability
{
/**
* @param list<class-string> $requiredClasses
*/
public function packageAvailable(string $packageName, array $requiredClasses = []): bool
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function livewireComponentAvailable(string $packageName, string $componentName): bool
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FoundationTheme\Contracts\OptionalExtensionAvailability::class, ExampleOptionalExtensionAvailabilityImplementation::class);
<?php
declare(strict_types=1);
final class ExampleProvidesThemeDemoContentImplementation implements \Capell\FoundationTheme\Contracts\ProvidesThemeDemoContent
{
/**
* @return array<int, ThemeDemoPageDefinition>
*/
public function definitions(string $themeKey, string $themeName, string $baseUrl): array
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FoundationTheme\Contracts\ProvidesThemeDemoContent::class, ExampleProvidesThemeDemoContentImplementation::class);
<?php
declare(strict_types=1);
final class ExampleResultsListingResolverImplementation implements \Capell\FoundationTheme\Contracts\ResultsListingResolver
{
public function handle(\Capell\Core\Models\Site $site, \Capell\Core\Models\Language $language, \Capell\Core\Models\Page $page): \Capell\FoundationTheme\Data\ResultsListingData
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FoundationTheme\Contracts\ResultsListingResolver::class, ExampleResultsListingResolverImplementation::class);
<?php
declare(strict_types=1);
$inputs = []; // Supply the arguments required by the action handle() method.
resolve(\Capell\FoundationTheme\Actions\InstallFoundationThemeDemoAction::class)->handle(...$inputs);
<?php
declare(strict_types=1);
$inputs = []; // Supply the arguments required by the action handle() method.
resolve(\Capell\FoundationTheme\Actions\SetupFoundationThemePackageAction::class)->handle(...$inputs);