subdomainto/symfony-bundle

Symfony bundle for the subdomain.to custom domains API with an autowired client, configuration, and signed webhook attributes.

Maintainers

Package info

github.com/subdomain-to/symfony-bundle

Homepage

Documentation

Type:symfony-bundle

pkg:composer/subdomainto/symfony-bundle

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-07-29 12:32 UTC

This package is auto-updated.

Last update: 2026-07-30 06:17:21 UTC


README

subdomainto/symfony-bundle integrates the subdomain.to custom domains API with Symfony. It configures the typed PHP client, enables autowiring, supports environment-based credentials, and verifies signed webhooks through a controller attribute.

The bundle supports Symfony 6.4, 7.4, and 8.x on PHP 8.1 or later.

Installation

composer require subdomainto/symfony-bundle

Symfony Flex normally registers the bundle. Configure the API client and webhook verifier:

# config/packages/subdomain_to.yaml
subdomain_to:
    api_key: '%env(SUBDOMAINTO_API_KEY)%'
    webhook_secret: '%env(SUBDOMAINTO_WEBHOOK_SECRET)%'
    webhook_tolerance: 300

Autowire the custom domains client

use SubdomainTo\Client;
use SubdomainTo\Model\Domain;

final class ConnectCustomerDomain
{
    public function __construct(private Client $subdomainTo) {}

    public function __invoke(string $customerId, string $hostname): Domain
    {
        return $this->subdomainTo->domains()->create(
            $hostname,
            $customerId.'-domain',
        );
    }
}

The client exposes typed resources for destinations, domains, DNS and TLS lifecycle status, webhooks, widget sessions, usage, and billing.

Verify a webhook controller

use SubdomainTo\Symfony\Attribute\VerifySubdomainToWebhook;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

#[VerifySubdomainToWebhook]
public function webhook(Request $request): Response
{
    $event = $request->attributes->get('subdomainto_event');

    return new Response(status: 204);
}

The attribute triggers verification of the untouched request body, SubdomainTo-Signature, HMAC signature, and timestamp before the controller runs.

Documentation

Read the Symfony SDK guide, browse the custom domains API documentation, or report an issue in the GitHub repository.

License

MIT