Skip to content

Laravel for Rust reference ​

The Rust crate, fusion-stack-laravel-rust (library fusion_stack), sends the same responses as the PHP package. These pages have the same sections as the PHP reference, for the Rust API. Headers, error codes and the error format are the same in both packages, so HTTP headers and Errors cover both.

Rust has no attributes or reflection, so what PHP reads from attributes and classes is declared in code: resources with Resource, endpoints with Config::endpoint, and route behaviour with middleware.

PageWhat it coversPHP page
ResourcesResource: attributes, relationships and descriptions.Requests and responses
QueriesApiQuery: includes, sparse fieldsets, filters, sorts and pagination.Queries
Middleware and endpointsRequiresScope, CacheControl, CacheResponse and openapi::Endpoint.Attributes
Version changesThe VersionChange trait and the document helpers.Version changes
ErrorsApiError, ApiErrorCode and your own codes.Errors
ConfigurationEvery Config method, with its config/api.php key.Configuration
Console commandsEvery api: command and its options.Artisan commands
Testing helpersApiRequest, ApiResponse and version change tests.Testing helpers

Every page's examples come from the monorepo's Rust playground, workbench/rust, which passes the same HTTP conformance cases as the PHP playground.

Released under the MIT License.