stechbd/sde

S Database Explorer (SDE) is a simple and lightweight MySQL database explorer library based on PHP and PDO.

3.0.1 2023-08-15 10:29 UTC

This package is auto-updated.

Last update: 2024-05-10 14:25:28 UTC


README

S Database Explorer (SDE) is a simple and lightweight MySQL database explorer library based on PHP and PDO. It is a free and open-source database management library that helps you to manage your MySQL database.

Table of Contents

Requirements

  • PHP >= 7.4
  • PDO PHP Extension
  • JSON PHP Extension

Features

  • Create table
  • Insert record
  • Update record
  • Delete record
  • Select record
  • Select all records
  • Select records with where clause
  • Select records with where clause and limit
  • Select records with where clause, limit and offset
  • Select records with where clause, limit, offset and order by
  • Run custom query

Change log

Version 3.0.1 (August 15, 2023)

  • Fixed bugs.

Version 3.0.0 (July 16, 2023)

  • Added support for PHP 7.4 or higher.
  • Replaced MySQLi with PDO.
  • Renamed 'custom query' method to run().
  • Renamed 'last insert item' method to last().
  • Renamed 'number of rows count' method to count().
  • Added 'JSON output' method.
  • Added 'sum' method.
  • Added CHANGELOG.md file.
  • Added composer support.

Version 2.0.0 (December 7, 2017)

  • Removed MySQL support and kept only MySQLi support.

Version 1.0.0 (August 14, 2015)

  • Initial release.

Please see CHANGELOG for more information on what has changed recently.

Installation

S Database Explorer (SDE) can be used directly using downloaded package or can be installed using composer:

composer require stechbd/sde

Usage

Autoload the library

require_once __DIR__ . '/vendor/autoload.php';

Connecting to a database

$sde = new STechBD\SDE('name', 'username', 'password', 'host', 'prefix');

Inserting a record

$sde->insert('users', 'name, email, password', ':name, :email, :password', [
    'name'      =>  'John Doe',
    'email'     =>  'john@stechbd.net',
    'password'  =>  '123456',
    'salary'    =>  '10000'
]);

Updating a record

$sde->update('users', 'email = :email', 'id = :id' [
	'email' =>  'doe@stechbd.net',
	'id'    =>  1
]);

Deleting a record

$sde->remove('users', 'id = :id', [
	'id' => 1
]);

Selecting records

Selecting all column

$sde->select('*', 'users');

Selecting specific columns

$sde->select('id, name, email', 'users');

Selecting records with where clause

$sde->select('id, name, email', 'users', 'id = :id', false, false, [
	'id' => 1
]);

Selecting records with where and limit clause

$sde->select('id, name, email', 'users', 'id = :id', 10, false, [
	'id' => 1
]);

Selecting records with where, limit, and order by clause

$sde->select('id, name, email', 'users', 'id = :id', '10, 0', 'id DESC', [
	'id' => 1
]);

Selecting records with where, limit, order by, and offset clause

$sde->select('id, name, email', 'users', 'id = :id', '10', 'id DESC', '15', [
	'id' => 1
]);

Running custom query

$sde->run('SELECT * FROM users WHERE id = 1');

Getting JSON output

$sde->json($result);

Getting last insert item

$sde->last();

Getting number of rows

$sde->count('users', 'id = :id', [
	'id' => 1
]);

Getting sum of a column

$sde->sum('users', 'salary', 'id = :id', [
	'id' => 1
]);

License

S Database Engine (SDE) is open-sourced software licensed under the GPLv3 license.

Security

If you discover any security-related issues, please email product@stechbd.net instead of using the issue tracker.

Future Plan

  • Create database
  • Drop database
  • Create table
  • Alter table
  • Drop table
  • Truncate table
  • Rename table
  • Add column
  • Rename column
  • Drop column
  • Add index
  • Drop index
  • Add foreign key
  • Drop foreign key
  • Add unique key
  • Drop unique key
  • Add primary key
  • Drop primary key
  • Add auto increment
  • Drop auto increment

Author

Contributors

None yet.

About S Technologies

S Technologies (STechBD.Net) is a research-based technology company in Bangladesh. It was founded in 2013. It provides services like domain registration, web hosting, web servers, software development, AI model development, software as a service (SasS), UI/UX design, SEO, business solutions, etc. S Technologies has been working in research of new technologies especially in artificial intelligence, and developing new products. You'll find an overview of all our open source products on our website.

Support

If you are having general issues with this package, feel free to contact us on STechBD.Net/support.

If you believe you have found an issue, please report it using the GitHub issue tracker, or better yet, fork the repository and submit a pull request.

Hire Us

Contribute

More

Copyright

© 2013-24 S Technologies. All rights reserved.