taylor-hawkes / tays-orm
Quick and easy ORM
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/taylor-hawkes/tays-orm
This package is not auto-updated.
Last update: 2026-01-08 01:37:22 UTC
README
This is a super simple class for saving/editing record in a mysql database. It really helps for quickly/easily updating single records. #installation & usage
Install with composer:
composer require taylor-hawkes\easy-connect composer require taylor-hawkes\tays-orm
Generate a new model with the generator script:
cd vendor/taylor-hawkes/tays-orm
php generate_model.php --table="users" --host="database_ip" --user="db_user" --pass="db_pass" --database="db_name" --table="tablename"
You can hard code the database params in the generate_table script so you don't have to put them in as params everytime.
This script by default installs all new Models and Base Models three directories up (in a TModel folder) from the TaysORM installation directory. You can edit where the script installs your Models.
Usage Examples:
Create a new user:
$user=new \TModel\Users(); $user->first_name="taylor"; $user->last_name="hawkes"; $user->save();
Edit a user:
$user=new \TModel\Users(); $user->fetchRow("1");// 1 is the value of the tables primary key $user->last_name="Malone"; // I got married and was forced to take my wifes name $user->save();
You can also fetch a row like this:
$user=new \TModel\Users(); $user->fetchRowWhere("first_name = 'taylor' and lastname ='hawkes'"); $user->last_name="Malone"; $user->save();
Selecting Multiple Records:
$user=new \TModel\Users(); $all_users= $user->fetchAssoc("select * from users");
All Other Queries:
$user=new \TModel\Users(); $do_something_else=$user->query("update users set ...");
Requirements
EasyConnect - [https://github.com/TaylorHawkes/EasyConnect]
License
MIT