All Projects → milroyfraser → Sarala

milroyfraser / Sarala

Licence: mit
Javascript library to communicate with RESTful API built following JSON API specification. inspired by Laravel’s Eloquent

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sarala

Laravel Mongodb
A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
Stars: ✭ 5,860 (+5701.98%)
Mutual labels:  orm, eloquent, laravel
Laravel Optimistic Locking
Adds optimistic locking feature to eloquent models.
Stars: ✭ 71 (-29.7%)
Mutual labels:  orm, eloquent, laravel
Eloquent Filter
This simple package helps you filter Eloquent data using query filters.
Stars: ✭ 24 (-76.24%)
Mutual labels:  orm, eloquent, laravel
Elasticsearch
The missing elasticsearch ORM for Laravel, Lumen and Native php applications
Stars: ✭ 375 (+271.29%)
Mutual labels:  orm, eloquent, laravel
Gorose
GoRose(go orm), a mini database ORM for golang, which inspired by the famous php framwork laravle's eloquent. It will be friendly for php developer and python or ruby developer. Currently provides six major database drivers: mysql,sqlite3,postgres,oracle,mssql, Clickhouse.
Stars: ✭ 947 (+837.62%)
Mutual labels:  orm, eloquent, laravel
Eloquent Settings
Eloquent Settings allows you to bind key-value pairs to any Laravel Eloquent model. It supports even casting for boolean, float or integer types.
Stars: ✭ 71 (-29.7%)
Mutual labels:  eloquent, laravel
Elasticquent
Maps Laravel Eloquent models to Elasticsearch types
Stars: ✭ 1,172 (+1060.4%)
Mutual labels:  eloquent, laravel
Laravel Lucene Search
Laravel 4.2, 5.* package for full-text search over Eloquent models based on ZF2 Lucene.
Stars: ✭ 75 (-25.74%)
Mutual labels:  eloquent, laravel
Eloquent Approval
Approval process for Laravel Eloquent models
Stars: ✭ 79 (-21.78%)
Mutual labels:  eloquent, laravel
Watchable
Enable users to watch various models in your application.
Stars: ✭ 65 (-35.64%)
Mutual labels:  eloquent, laravel
Laravel Schedulable
Schedule and unschedule eloquent models elegantly without cron jobs
Stars: ✭ 78 (-22.77%)
Mutual labels:  eloquent, laravel
Laravel Approvable
Easily add an approval process to any laravel model.
Stars: ✭ 79 (-21.78%)
Mutual labels:  eloquent, laravel
Demo Laravel Json Api
Demo of JSON API integration with a Laravel Application
Stars: ✭ 68 (-32.67%)
Mutual labels:  json-api, laravel
Laravel Ownership
Laravel Ownership simplify management of Eloquent model's owner.
Stars: ✭ 71 (-29.7%)
Mutual labels:  eloquent, laravel
Laravel Restful Api Starter
Build a RESTful API with Laravel and MongoDB
Stars: ✭ 66 (-34.65%)
Mutual labels:  restful-api, laravel
Requent
A GraphQL like interface to map a request to eloquent query with data transformation for Laravel.
Stars: ✭ 78 (-22.77%)
Mutual labels:  eloquent, laravel
Laravel Nullable Fields
Handles saving empty fields as null for Eloquent models
Stars: ✭ 88 (-12.87%)
Mutual labels:  eloquent, laravel
Evolutility Server Node
Model-driven REST or GraphQL backend for CRUD and more, written in Javascript, using Node.js, Express, and PostgreSQL.
Stars: ✭ 84 (-16.83%)
Mutual labels:  restful-api, orm
Laravel Prefixed Ids
Friendly prefixed IDs for Laravel models
Stars: ✭ 88 (-12.87%)
Mutual labels:  eloquent, laravel
Laravel Likeable
Rate Eloquent models with Likes and Dislikes in Laravel. Development moved to Laravel Love package!
Stars: ✭ 95 (-5.94%)
Mutual labels:  eloquent, laravel

Coverage Status

Sarala JS

Javascript library to communicate with RESTful API built following JSON API specification. inspired by Laravel’s Eloquent

API Documentation | Background Story

Install

$ npm i sarala --save
$ yarn add sarala

Basic Usage

Model Implementation

app/models/BaseModel.js
import { Model } from 'sarala';
import axios from 'axios';

export default class BaseModel extends Model
{
    baseUrl () {
        return 'https://sarala-demo.app/api';
    }

    request (config) {
        return axios.request(config);
    }
}
app/models/Post.js
import Model from './BaseModel';
import Tag from './Tag';

export default class Post extends Model {
    resourceName () {
        return 'posts';
    }

    fields () {
        return ['title', 'subtitle', 'body', 'slug'];
    }

    relationships () {
        return {
            tags: new Tag()
        };
    }
}
app/models/Tag.js
import Model from './BaseModel';

export default class Tag extends Model {
    resourceName () {
        return 'tags';
    }

    fields () {
        return ['name'];
    }
}

Fetching data

import Post from './../models/Post';

const post = new Post();

// makes a GET request to https://sarala-demo.app/api/posts
const fetchAllPosts = async () => {
    let posts = await post.with(['tags']).all();
};

Insert

app/components/MyComponent.js
import Tag from './../models/Tag';

const tag = new Tag();
tag.name = 'json-api';

// makes a POST request to https://sarala-demo.app/api/tags
tag.save(); 
// or you can directly call tag.create();

Change log

Please see CHANGELOG for more information on what has changed recently.

API Documentation | Background Story

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].