Skip to content
On this page

Requests

Definitions

Spire tries to mimic Laravels Request Handling / Behaviour as much as possible, since it's meant to be used with Laravel (although not exclusively).

This is done to ease Fullstack development and make more backend-type developers more comfortable in the frontend.

Given that, we can map out the following:

LaravelSpire
FormRequestRequest
ResourceResource
CollectionCollection
ExceptionException

A Spire Request is basically a Laravel FormRequest, just represented as a pure typescript type, instead of a php class.

Code Generation

WIP

We can also do code generation quite easily since we're using similar conventions. We can create typescript types from our Laravel Code.

Additional considerations

  • Having declaratives types for each Request and Resource creates more type stability. You don't end up with a "Model" that has 20 optional properties. You know exactly what you get and can send in a Request.
  • You can use the same search-terms / classnames in the backend and frontend, which is another plus in backend/frontend mono-repositories.