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
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"
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);