Configuration
Config is config/api.php as builder methods. Each section below matches a section of the PHP Configuration page.
use fusion_stack::rate_limit::Tier;
use fusion_stack::versioning::Versions;
use fusion_stack::{Config, FusionStack};
let api = FusionStack::new(
Config::new()
.resource(orders)
.versions(Versions::new("2026-11-30").version("2026-11-30", vec![]))
.rate_limit_tier("sandbox", Tier::new(3, 60)),
);request_id
| Method | PHP key | Default |
|---|---|---|
request_ids(bool) | api.request_id.enabled | true |
auth
| Method | PHP key | Default |
|---|---|---|
auth(bool) | api.auth.enabled | true |
client_resolver(auth::resolver(...)) | api.auth.guards, api.auth.resolvers | The crate's API keys only |
test_keys_in_production(allow) | api.auth.test_keys_in_production | false |
A resolver gets the request's headers and returns an ApiClient, or None to fall through to API keys and then a guest.
rate_limit
| Method | PHP key | Default |
|---|---|---|
rate_limit(bool) | api.rate_limit.enabled | true |
rate_limit_tier(name, Tier) | api.rate_limit.tiers | guest 60 and default 300 a minute |
Tier::new(limit, per_seconds) or Tier::unlimited(); pass None to remove a tier.
versions
| Method | PHP key | Default |
|---|---|---|
versions(Versions) | api.versions | Versioning off |
track_usage(bool) | api.versions.track_usage | true |
Versions::new(latest) takes default_version, version (one per version, with its changes), retired, keep (2), deprecated with Deprecated::new().since().sunset().brownout(), changelog_url and upgrade_guide_url.
query
| Method | PHP key | Default |
|---|---|---|
resource(Resource) | The resource classes | None |
page_sizes(default, max) | api.query.page_size, api.query.max_page_size | 25, 100 |
max_include_depth(depth) | api.query.max_include_depth | 3 |
idempotency
| Method | PHP key | Default |
|---|---|---|
idempotency(bool) | api.idempotency.enabled | true |
idempotent_methods([...]) | api.idempotency.methods | POST, PATCH, DELETE |
idempotency_times(ttl, lock_seconds) | api.idempotency.ttl, api.idempotency.lock_seconds | A day, 60 seconds |
idempotency_store(Option<&str>) | api.idempotency.store | The default store |
http_cache
| Method | PHP key | Default |
|---|---|---|
etags(bool) | api.http_cache.etags | true |
cache_control(Option<&str>) | api.http_cache.cache_control | private, no-cache |
vary([...]) | api.http_cache.vary | Api-Version, Authorization, Accept |
response_cache
| Method | PHP key | Default |
|---|---|---|
response_cache(bool) | api.response_cache.enabled | true |
response_cache_store(Option<&str>) | api.response_cache.store | The default store |
openapi
| Method | PHP key | Default |
|---|---|---|
endpoint(route, Endpoint) | #[Endpoint] on each action | None |
openapi_info(title, description) | api.openapi.title, api.openapi.description | APP_NAME |
openapi_servers([...]) | api.openapi.servers | APP_URL |
openapi_version(version) | api.openapi.version | 1.0.0 |
error_codes([...]) | api.openapi.error_codes | None |
docs
docs(Docs) sets api.docs; mount the pages with fusion_stack::docs::routes(route).
Docs method | PHP key | Default |
|---|---|---|
path(path) | api.docs.path | docs |
renderer(Renderer::Scalar or Redoc) | api.docs.renderer | Scalar |
scalar_url(url), scalar_integrity(hash), scalar_config(map) | api.docs.scalar.* | Scalar 1.86.1 on jsDelivr, its hash, none |
redoc_url(url), redoc_integrity(hash) | api.docs.redoc.* | Redoc 2.5.4 on Redoc's CDN, its hash |
lint_fails(bool) | api.docs.lint = fail | false (warn) |
Wrap the routes call in a group to add middleware, as api.docs.middleware does.
scalar_url and redoc_url load the script you name unchecked: the default hash fits only the default file. Call scalar_integrity or redoc_integrity after them with the hash of your file.
webhooks
Needs the database feature.
| Method | PHP key | Default |
|---|---|---|
webhook_delivery(timeout, backoff, disable_after) | api.webhooks.timeout, backoff, disable_after | 10 s; a minute up to 12 hours; 5 |
webhook_queue(connection, queue) | api.webhooks.connection, queue | The defaults |
webhook_private_addresses(allow) | api.webhooks.allow_private_addresses | false |
errors
| Method | PHP key | Default |
|---|---|---|
error_paths([...]) | api.errors.paths | ["*"] |