Skip to content

tamagokun/transport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Transport

A data store designed to allow the use of any data technology:

  • File system
  • SQL
  • MongoDB

This will allow you to design data driven applications with models that are not specific to the source of data.

How it works

Have your data models extend Model:

<?php
	class Person extends \Transport\Model
	{

	}

Configure your connection:

<?php
$store = new \Transport\Store();
$store->config("mongodb://localhost/my_db");

API

  • ::find($query=null) aliases: where - Find and return a set of records based on a query.

  • ::find_by_$prop($query=null) - Directly query a proprty.

  • ->filter($query=null) - aliases: find() where() - Filter a result.

  • ::first($query=null) - Run a query and return the first element.

  • ::last($query=null) - Run a query and return the last element.

  • ->first() - Return the first element of a data cursor.

  • ->last() - Return the last element of a data cursor.

  • ->sort() aliases: order() - Sort the elements of a data cursor.

  • ->sort_by_$prop() aliases: order_by_$prop() - Sort the elements of a data cursor directly by a property.

  • ->limit() - Only allow a set number of results.

  • ->destroy() - Destroy an instance of a record.

  • ::new($attributes = array()) - Create a record.

  • ->update_attributes($attributes=array()) - Update an existing record's attributes.

  • ->save() - Save a record.

Hooks

  • create before/after
  • save before/after
  • update before/after
  • destroy before/after

About

PHP data store for any technology stack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages