Skip to main content
This guide walks you through the core Exo concept: Resource creation. You will define one Resource and then use the API and triggers generated from it.

What is a Resource?

A Resource is a PHP class that tells Exo:
  • Which model to expose (for example: User, Contact, Invoice)
  • Which data shape to return through API and webhooks
  • Which trigger events to emit (on_create, on_update, on_delete)

Generate it

This creates app/Exo/Resources/UserResource.php.

Define the required methods

Every Resource implements name(), model(), triggers(), and transform().

What Exo generates from this Resource

After app boot, Exo auto-discovers your Resource and registers:
  • GET /exo-api/resources (resource metadata)
  • GET /exo-api/resources/user (list)
  • GET /exo-api/resources/user/{id} (single record)
  • POST /exo-api/resources/user (create)
  • PUT /exo-api/resources/user/{id} (update)
  • DELETE /exo-api/resources/user/{id} (delete)
  • Trigger emission for on_create, on_update, and on_delete

Test the generated API

Confirm registration:
Create a user:
List users:

Add medium-level controls

Once this works, add optional methods for:
  • Validation with createRules() and updateRules()
  • Ownership with ownerColumn() and is_admin callback
  • Query control with searchableColumns() or applySearch()
  • Operation flags with supportsCreate(), supportsUpdate(), supportsDelete()

Next steps

Resource guides

Continue with transformers, CRUD behavior, ownership, and search.

Webhooks

See how your Resource triggers become webhook deliveries.