https://github.com/oussemakh1/orm-package
This a native php orm package that works with mysql it's main objectif is to facilitate the crud process in your application, contains all crud opreations like (insert, edit, update, delete, soft_delete) as well search operation
https://github.com/oussemakh1/orm-package
mysql-database orm-library php php-library
Last synced: 2 months ago
JSON representation
This a native php orm package that works with mysql it's main objectif is to facilitate the crud process in your application, contains all crud opreations like (insert, edit, update, delete, soft_delete) as well search operation
- Host: GitHub
- URL: https://github.com/oussemakh1/orm-package
- Owner: oussemakh1
- Created: 2021-08-15T01:01:20.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-15T15:52:09.000Z (almost 5 years ago)
- Last Synced: 2025-07-22T21:46:28.090Z (about 1 year ago)
- Topics: mysql-database, orm-library, php, php-library
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# orm-package
This a native php orm package that works with mysql it's main objectif is to facilitate the crud process in your application, contains all crud opreations like (insert, edit, update, delete, soft_delete) as well search operation
# setup
1- composer require oussemakhlifi/orm-package
2- setup your .env file with following varibales
- db_host = "host"
- db_username = "database username"
- db_password = "database password"
- db_name = "database name"
# usage
insert example:
$db = new \MysqlDB\MysqlDB();
$table_name = "products";
$columns = ["name", "category", "price"];
$values = ["samsung a21", "phone", "1500"];
$insert = $db->insert($table_name, $columns, $values);
select example:
$db = new \MysqlDB\MysqlDB();
$table_name = "products";
$where = "id";
$value = 1;
$orderby = "id";
$option = "desc";
$select = $db->select($table_name, $where, $value, $orderby, $option);
select by operator example:
$db = new \MysqlDB\MysqlDB();
$table_name = "products";
$column = "price";
$operation = "=";
$value = 1500;
$orderby = "id";
$option = "desc";
$select = $db->selectByOperator($table_name, $column, $operation, $value, $orderby, $option);
update example:
$db = new \MysqlDB\MysqlDB();
$table_name = "products";
$where = "id";
$where_value = "1";
$columns = ["name", "category", "price"];
$values = ["samsung a22", "phone", "1000"];
$update = $db->update($table_name, $columns,$where, $where_value, $values);
delete example:
$db = new \MysqlDB\MysqlDB();
$table_name = "products";
$column = "id";
$value = "1";
$delete = $db->delete($table_name, $colum, $value);
soft delete example:
$db = new \MysqlDB\MysqlDB();
$table_name = "products";
$column = "id";
$value = "1";
$soft_delete = $db->soft_delete($table_name, $colum, $value);
search example:
$db = new \MysqlDB\MysqlDB();
$table_name = "products";
$column = "category";
$value = "phone";
$search = $db->search($table_name, $column, $value);