taq / Torm
Licence: gpl-2.0
Just another simple PHP ORM. You can use it, but don't ask me why I made it. :-)
Stars: ✭ 90
Labels
Projects that are alternatives of or similar to Torm
Scala Activerecord
ActiveRecord-like ORM library for Scala
Stars: ✭ 324 (+260%)
Mutual labels: orm, activerecord
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (+37.78%)
Mutual labels: orm, activerecord
Active importer
Define importers that load tabular data from spreadsheets or CSV files into any ActiveRecord-like ORM.
Stars: ✭ 333 (+270%)
Mutual labels: orm, activerecord
Sqlalchemy Mixins
Active Record, Django-like queries, nested eager load and beauty __repr__ for SQLAlchemy
Stars: ✭ 441 (+390%)
Mutual labels: orm, activerecord
Topaz
A simple and useful db wrapper for Crystal-lang
Stars: ✭ 56 (-37.78%)
Mutual labels: orm, activerecord
Jennifer.cr
Crystal ORM using ActiveRecord pattern with flexible query DSL
Stars: ✭ 309 (+243.33%)
Mutual labels: orm, activerecord
Datamappify
Compose, decouple and manage domain logic and data persistence separately. Works particularly great for composing form objects!
Stars: ✭ 338 (+275.56%)
Mutual labels: orm, activerecord
Baby squeel
🐷 An expressive query DSL for Active Record 4 and 5
Stars: ✭ 362 (+302.22%)
Mutual labels: orm, activerecord
Objectivesql
ObjectiveSQL is an ORM framework in Java based on ActiveRecord pattern, which encourages rapid development and clean, codes with the least and convention over configuration.
Stars: ✭ 1,109 (+1132.22%)
Mutual labels: orm, activerecord
Resty
The minimalist framework of RESTful(server and client) - Resty
Stars: ✭ 1,268 (+1308.89%)
Mutual labels: activerecord
Chloe
A lightweight and high-performance Object/Relational Mapping(ORM) library for .NET --C#
Stars: ✭ 1,248 (+1286.67%)
Mutual labels: orm
Butterfly
🔥 蝴蝶--【简单】【稳定】【好用】的 Python web 框架🦋 除 Python 2.7,无其他依赖; 🦋 butterfly 是一个 RPC 风格 web 框架,同时也是微服务框架,自带消息队列通信机制实现分布式
Stars: ✭ 82 (-8.89%)
Mutual labels: orm
Fluent Plugin Sql
SQL input/output plugin for Fluentd
Stars: ✭ 82 (-8.89%)
Mutual labels: activerecord
Hibernate Performance
Samples for "Hibernate performance tuning" talk
Stars: ✭ 87 (-3.33%)
Mutual labels: orm
Orator
The Orator ORM provides a simple yet beautiful ActiveRecord implementation.
Stars: ✭ 1,234 (+1271.11%)
Mutual labels: orm
TORM
Just another simple ORM for PHP. You can use it, but don't ask why I made it. Right? :-)
Usage
Take a look on the Github Wiki for documentation, but let me show the basics here:
<?php
// open the PDO connection and set it
$con = new PDO("sqlite:database.sqlite3");
TORM\Connection::setConnection($con);
TORM\Connection::setDriver("sqlite");
// define your models - an User class will connect to an users table
class User extends TORM\Model {};
class Ticket extends TORM\Model {};
// create some validations
User::validates("name", ["presence" => true]);
User::validates("email", ["presence" => true]);
User::validates("email", ["uniqueness" => true]);
User::validates("id", ["numericality" => true]);
// create some relations
User::hasMany("tickets");
User::hasOne("account");
Ticket::belongsTo("user");
// this will create a new user
$user = new User();
$user->name = "John Doe";
$user->email = "[email protected]";
$user->level = 1;
$user->save();
// this will find the user using its primary key
$user = User::find(1);
// find some users
$users = User::where(["level" => 1]);
// find some users, using more complex expressions
// the array first element is the query, the rest are values
$users = User::where(["level >= ?", 1]);
// updating users
User::where(["level" => 1])->updateAttributes(["level" => 3]);
// using fluent queries
$users = User::where(["level" => 1])->limit(5)->order("name desc");
// listing the user tickets
foreach($user->tickets as $ticket) {
echo $ticket->description;
}
// show user account info
echo $user->account->number;
?>
Testing
SQLite
First, use composer update
to make sure everything is ok with all the
packages. Then, go to the test
directory and run run
. It will requires the
SQLite driver so make sure it is
available. If not, check the php.ini
dir found with
$ php -r 'phpinfo();' | grep 'php.ini'
Configuration File (php.ini) Path => /etc/php/7.1/cli
Loaded Configuration File => /etc/php/7.1/cli/php.ini
and, if not found there or on the conf.d
on the same location the php.ini
file is, it can be installed, on Ubuntu, using:
$ sudo apt install php-sqlite3
Multibyte strings, locale and YAML
$ sudo apt install php-mbstring php-intl php-yaml
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].