Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/md-aamroni/eloquent
PDO Connection and MySQL Queries in PHP
https://github.com/md-aamroni/eloquent
db-connection eloquent mysql-database pdo-mysql query-builder
Last synced: about 1 month ago
JSON representation
PDO Connection and MySQL Queries in PHP
- Host: GitHub
- URL: https://github.com/md-aamroni/eloquent
- Owner: md-aamroni
- License: mit
- Created: 2022-02-01T17:25:04.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-01T17:27:49.000Z (almost 3 years ago)
- Last Synced: 2024-10-01T18:08:10.827Z (about 1 month ago)
- Topics: db-connection, eloquent, mysql-database, pdo-mysql, query-builder
- Language: PHP
- Homepage: https://md-aamroni.github.io
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PDO Connection and MySQL Queries in PHP
![workflow](https://github.com/md-aamroni/eloquent/actions/workflows/application.yml/badge.svg)
![Copyright](https://img.shields.io/badge/Copyright-aDecoder-brightgreen.svg)
[![License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](./LICENSE)
![Developed](https://img.shields.io/badge/PHP->=8.0-brightgreen.svg)
![Copyright](https://img.shields.io/badge/Developer-md.aamroni-brightgreen.svg)### Installation
```bash
composer require adecoder/eloquent
```### [Environment File](env-example)
```env
DB_APP_HOST=localhost
DB_APP_PORT=3308
DB_APP_NAME=xtra_guideasy_app_rdb
DB_APP_CHAR=utf8mb4
DB_APP_USER=root
DB_APP_PASS=
```### Select Statement
```php
use Adecoder\Eloquent\Eloquent;$query = "SELECT * FROM table_name WHERE id = :B_SEARCH;";
$param = array(':B_SEARCH' => 2);$select = Eloquent::select(query: $query, param: $param, itself: false)->get();
dd($select);
```### Create Statement
```php
use Adecoder\Eloquent\Eloquent;$query = "INSERT INTO table_name (username, email_id) VALUE(:B_USER, :B_MAIL)";
$param = array(':B_USER' => 'md.aarmoni', ':B_MAIL' => '[email protected]');$create = Eloquent::create(query: $query, param: $param, array: false)->get();
dd($create);
```### Delete Statement
```php
use Adecoder\Eloquent\Eloquent;$query = "DELETE FROM table_name WHERE id = :B_DELETE;";
$param = array(':B_DELETE' => 14);$delete = Eloquent::delete(query: $query, param: $param, array: false)->get();
dd($delete);
```### Update Statement
```php
use Adecoder\Eloquent\Eloquent;$query = "UPDATE table_name SET username = :B_USER, email_id = :B_MAIL WHERE id = :B_UPDATE;";
$param = array(':B_USER' => 'md-aarmoni', ':B_MAIL' => '[email protected]', ':B_UPDATE' => 14);
$update = Eloquent::update(query: $query, param: $param, array: false)->get();
dd($update);
```