seleda/dbeasy

Maintainers

Details

github.com/Seleda/dbeasy

Source

Issues

Installs: 53

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/seleda/dbeasy

v0.0.6 2024-06-10 16:15 UTC

This package is auto-updated.

Last update: 2025-10-10 19:42:58 UTC


README

Easy connection and work with the database

Project setup

composer require seleda/dbeasy

Usage

Define global constants before calling:

  • _DB_SERVER_
  • _DB_USER_
  • _DB_PASSWD_
  • _DB_NAME_
  • _DB_PREFIX_(optional)

or

Seleda\Dbeasy\Db::$_servers = [
    [
        'server' => '',
        'user' => '',
        'password' => '',
        'database' => ''
    ]
];

Methods

Db::getInstance()->insert('table_without prefix', [
    'column' => $value
]);
Db::getInstance()->update('table_without prefix', [
    'column' => $value
], 'condition');
Db::getInstance()->delete('table_without prefix', 'condition');

Executes a query.

Db::getInstance()->execute($qyery);

Executes return the result of $sql as array.

Db::getInstance()->executeS($sql);

Returns an associative array containing the first row of the query This function automatically adds "LIMIT 1" to the query.

Db::getInstance()->getRow($sql);

Returns a value from the first row, first column of a SELECT query.

Db::getInstance()->getValue($sql);