Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

API Docs

Hunter Perrin edited this page Nov 4, 2017 · 1 revision

The API docs cover everything you will need to create a webapp using Nymph. If you don't have Nymph set up yet, check out the Setup Guide.

Sections

Introduction

Nymph data objects for PHP and JavaScript. Data in Nymph is based on objects called entities. An entity is an object which can hold most types of data available in PHP and JavaScript, including other entities. Using Nymph, practically all of an app's code can be written on the client side, if you prefer.

Entities are not strictly structured, so data of any type can be added and saved just by assigning a property on the entity and calling save. This makes data manipulation in Nymph very easy. However, when you're done prototyping, and you're ready to launch a real app, it is highly recommended to use a validation library to enforce a schema for your entities. Respect/Validation is a good one. You can do this in the save method on your entities before calling return parent::save();.

All entities are given a globally unique identifier (GUID), which is an integer between 0 and 2^53 (9007199254740992). No entities in the same Nymph database would ever have the same GUID. Nymph also provides UIDs, which are sequential and can be used to number entities (or anything else). UIDs can be used to provide a more visibly pleasing identifier for entities.

When querying entities with Nymph, the ETYPE constant on the class determines which table Nymph will look in. If an entity is referenced in another entity's property, the class is saved along with the GUID. When this property is accessed later, Nymph will retrieve the referenced entity using the saved class.

⚠️ Caution: When changing an entity's class name, any entities referencing it must be resaved after setting the reference again using the new class name.

Clone this wiki locally