Download the PHP package socialdept/tenant-domains without Composer

On this page you can find all versions of the php package socialdept/tenant-domains. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tenant-domains

Custom domains for multi-tenant Laravel apps. Cloudflare for SaaS, without Cloudflare for SaaS.



What is Tenant Domains?

Tenant Domains lets your tenants bring their own domain. It proves they own it, tells them the exact records to create in the words their DNS provider uses, gets a certificate without ever touching their zone, makes your edge serve it, and then proves a real request actually lands on the right origin.

Think of it as Cloudflare for SaaS, the Custom Hostnames product, running on your own Caddy for the price of a DNS zone you already have.

Why use Tenant Domains?

Quick Example

Installation

Point the package at your platform:

Naming the records

Every hostname the package hands a tenant is configurable. The defaults are a convention, not a requirement, and nothing in the code assumes them.

Setting Default What it is
routing.cname_target to.{platform} Where tenant subdomains CNAME to
routing.ingress_ips none Addresses an apex A record may use
certificates.delegation_suffix acme.{platform} Zone that answers DNS-01 challenges
ownership.prefix _verify Label of the ownership TXT record
ownership.value_prefix verification= What that record's value starts with

{platform} expands to your platform domain, and it is optional. Drop it and the value is used verbatim, so the target can be anything that resolves:

The delegation suffix is independent too, so challenges can be answered by whichever zone you can actually write to rather than a subdomain of the platform.

If you are adopting this over an existing implementation, set these to match the records your tenants have already created. Changing them on a live platform invalidates every domain already verified.

With the defaults, that means creating one record in your own zone: to.yourapp.com, pointing at your ingress.

Getting Started

1. Tell the package who owns a domain

Your tenant model supplies the token that ends up in the ownership TXT record. It has to be stable for the life of the tenant, because rotating it invalidates every domain already verified against it. It also must not be guessable from the tenant's public identity.

2. Mix the trait into your domain model

No stancl? Extend SocialDept\TenantDomains\Models\Domain instead.

3. Point your edge at the certificate authority endpoint

Your edge asks this before obtaining a certificate for a hostname it does not recognise. The package registers it at api/caddy/verify, and the path is yours to change:

Prefer to own the route entirely? Turn registration off and declare it wherever your API conventions put it:

Whichever path you choose has to match your edge config. In Caddy that is the ask value in the on_demand_tls block. Keep the endpoint unauthenticated but unreachable from outside, because the edge calls it over loopback and a public one leaks which domains you host.

It denies by default. Anything your app does not explicitly claim gets a 404. If you serve per-account hostnames that have no row of their own, widen it:

4. Schedule the reconciler

Tenants paste their records and close the tab. DNS propagates twenty minutes later. This is what finishes the job without them coming back.

Certificate modes

The single most consequential setting. It decides what your platform can offer.

delegated_dns on_demand
Challenge DNS-01 in your zone HTTP-01 / TLS-ALPN
Needs admin API plus a zone you control nothing
Wildcards yes no. Neither challenge can prove one
Tenant behind a CDN fine fragile
Per-domain edge config one policy each none

delegated_dns is the default. Choose on_demand only if every custom domain shares one origin and you will never need a wildcard. The package refuses a wildcard binding outright rather than letting it silently never get a certificate.

How the delegation works

CertMagic does not follow the tenant's _acme-challenge CNAME. It resolves the challenge name to its SOA and asks your DNS provider for that zone, which you do not own, then fails with expected 1 zone, got 0. Silently, after setup already reported success.

The fix is override_domain, which this package writes into a per-domain automation policy. It replaces the record name outright so the TXT lands at the delegation target inside your zone. Let's Encrypt does follow CNAMEs when validating, so it chases the tenant's record to the same place and reads it there.

The override is per solver, so it is per policy, so it is one policy per custom domain.

Drivers

Zone. cloudflare, manual (logs what to create by hand), null. Ingress. caddy, null (for a statically configured edge).

Register your own from a service provider:

Testing

The package ships fakes so your app's domain lifecycle is testable without DNS or an edge:

ArrayResolver::fail() simulates a resolver outage. That is a different thing from a missing record, and it must never be reported as the tenant's fault.

Requirements

Resources

Support & Contributing

Found a bug or have a feature request? Open an issue.

Want to contribute? Check out the contribution guidelines.

Credits

License

Tenant Domains is open-source software licensed under the MIT license.


Built for Multi-Tenant Laravel • By Social Dept.


All versions of tenant-domains with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
jeremykendall/php-domain-parser Version ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package socialdept/tenant-domains contains the following files

Loading the files please wait ...