2017 © Pedro Peláez
 

library orm

Transactd ORM

image

transactd/orm

Transactd ORM

  • Tuesday, January 10, 2017
  • by bizstation
  • Repository
  • 2 Watchers
  • 5 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

TransactdORMPHP

The TransactdORMPHP is PHP ORM library using the Transactd plugin for MySQL/MariaDB. It is a fastest ORM for PHP., (*1)

Description

  • High-speed database access.
  • A Model is possible to high speed access to properties.
  • It can be used as the ActiveRecord.
  • Easy to migrate from the Laravel in similar interface to Laravel5.
  • It does not depend on any framework. Also available on any PHP framework.

Execution environment

Database

Client

Install

Composer

  • Install via the composer.
$ cd [yourProjectDirectory]
$ composer require Trnasactd/orm
  • Add the following to the beginning of your code.(If not added.)
<?php
require __DIR__ . '/vendor/autoload.php'

Manual

  1. Download form the GitHub., (*2)

  2. Extruct to your project directry., (*3)

  3. Add the following to the beginning of your code.
<?php
require __DIR__ . '/TransactdORMPHP-master/src/Require.php'

Connect to databases

Master and Slave host, these are possible to same host. If you specify a different host, the write operation is the master and the read operation is processed by the slave., (*4)

Laravel 5.1 above

  • Add the following class to your config/app.php service providers list.
Transactd\boot\Laravel\TransactdLaravelServiceProvider::class,
  • Add following parameters to your .env file.
// Master and Slave. These are possible to same host.
TRANSACTD_MASTER=tdap://yousername@your_master_host/your_database?&pwd=xxxx
TRANSACTD_SLAVE=tdap://yousername@your_slave_host/your_database?&pwd=xxxx

Otherwise

  • Add the following code to your application code at beggining.
class_alias('Transactd\DatabaseManager', 'DB');
$masterUri = 'tdap://yousername@your_master_host/your_database?&pwd=xxxx';
$slaveUri = 'tdap://yousername@your_slave_host/your_database?&pwd=xxxx';
DB::connect($masterUri, $slaveUri);

Usage example

Table names and field names follow the rules of ActiveRecord., (*5)

```php: <?php require DIR . '/TransactdORMPHP-master/src/Require.php', (*6)

use BizStation\Transactd\Transactd; use BizStation\Transactd\Database; use Transactd\Model;, (*7)

class Group extends Model { public function customers() { this->hasMany('Customer', 'group') } }, (*8)

class Customer extends Model { public function group() { return $this->belongsTo('Group', 'group', 'id'); } }, (*9)

// Connect to databases (Master and Slave. These are possible to same host.) class_alias('Transactd\DatabaseManager', 'DB'); $masterUri = 'tdap://root@masterhost/test?pwd=xxxx'; $slaveUri = 'tdap://root@slavehost/test?pwd=xxxx'; DB::connect($masterUri, $slaveUri);, (*10)

// Get all customers $customers = Customer::all(); echo 'The first customer's id = '. $customers[0]->id;, (*11)

// Get all customers with group relationship in a snapshot. DB::beginSnapshot(); $customers = Customer::with('group')->all(); DB::endSnapshot();, (*12)

// Find a customer id = 1 $customer = Customer::find(1); echo 'The customer name is '. $customer->name;, (*13)

// Find customers that group number is 3. // Transactd query are required that index number and keyValue for start of search. $customers = Customer::index(1)->keyValue(3)->where('group','=', 3)->get(); echo 'There are '.count($customers).' customers in Group 3.';, (*14)

// Get a group ralationship from a customer. (belongsTo) $customer = Customer::find(1); $group = $customer->group;, (*15)

// Get customers ralationship from a group. (hasMany) $group = Group::find(1); $customers = $group->customers;, (*16)

// Save a new customer. $customer = new Customer(); $customer->id = 0; //autoincrement $customer->group = 1; $customer->save();, (*17)

// Delete a customer in a transaction. DB::beginTransaction(); $customer->delete(); DB::commit();, (*18)

// Using native API $db = DB::master(); $tb = $db->openTable('customrs'); ..., (*19)

```, (*20)

Documents

  1. Tutorial
  2. Trnasactd ORM for PHP API
  3. Trnasactd Client PHP API

Bug reporting, requests and questions

If you have any bug-reporting, requests or questions, please send it to Issues tracker on github., (*21)

License

This package is licensed under the MIT license., (*22)

The Versions

10/01 2017

dev-master

9999999-dev http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • ext-transactd *
  • php >=5.4.0

 

by transactd

orm transactd

10/01 2017

1.5.0

1.5.0.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

05/01 2017

1.4.4

1.4.4.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

05/01 2017

1.4.3

1.4.3.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

22/12 2016

1.4.2

1.4.2.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

21/12 2016

1.4.1

1.4.1.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

21/12 2016

1.4.0

1.4.0.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

14/12 2016

1.3.1

1.3.1.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

14/12 2016

1.3.0

1.3.0.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

02/12 2016

1.2.0

1.2.0.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

24/11 2016

1.1.2

1.1.2.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

24/11 2016

1.1.0

1.1.0.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

24/11 2016

1.1.1

1.1.1.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

09/11 2016

1.0.7

1.0.7.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

07/11 2016

1.0.6

1.0.6.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd

21/10 2016

1.0.5

1.0.5.0 http://www.bizstation.jp/en/transactd/

Transactd ORM

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-transactd *

 

by transactd

orm transactd