Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/byalperens/sqlconfig
https://github.com/byalperens/sqlconfig
config configuration php sqlite sqlite-database sqlite3 sqlite3-database
Last synced: about 2 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/byalperens/sqlconfig
- Owner: ByAlperenS
- License: gpl-3.0
- Created: 2021-10-03T13:35:24.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-16T06:43:10.000Z (about 3 years ago)
- Last Synced: 2023-07-27T18:08:25.479Z (over 1 year ago)
- Topics: config, configuration, php, sqlite, sqlite-database, sqlite3, sqlite3-database
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SqlConfig
> Sqlite Config for new beginners
## API:
#### Create Table:
```php
$this->sqlconfig = SqlConfig::createDatabase($this->getDataFolder(), "example.db");
SqlConfig::createTable($this->sqlconfig, "Example", [
"name" => "string",
"surname" => "string",
"age" => "int"
]);
```
#
#### Insert:
```php
SqlConfig::insertToTable($this->sqlconfig, "Example", [
"name" => "Alperen",
"surname" => "Sancak",
"age" => 15
]);
```
#
#### Delete:
```php
SqlConfig::removeFromTable($this->sqlconfig, "Example", [
"name" => "Alperen",
"surname" => "Sancak"
]);
```
#
#### Select:
```php
$result = SqlConfig::selectTable($this->sqlconfig, "Example", [
"name",
"surname"
], [
"name" => "Alperen"
]);
var_dump($result);
```
##### Result:
```console
array(1) {
[0]=>
array(4) {
[0]=>
string(7) "Alperen"
["name"]=>
string(7) "Alperen"
[1]=>
string(6) "Sancak"
["surname"]=>
string(6) "Sancak"
}
}
```
#
#### Select All:
```php
$result = SqlConfig::selectAllTable($this->sqlconfig, "Example");
var_dump($result);
```
##### Result:
```console
array(2) {
[0]=>
array(6) {
[0]=>
string(10) "Ahmet Eren"
["name"]=>
string(10) "Ahmet Eren"
[1]=>
string(6) "Sancak"
["surname"]=>
string(6) "Sancak"
[2]=>
int(15)
["age"]=>
int(15)
}
[1]=>
array(6) {
[0]=>
string(7) "Alperen"
["name"]=>
string(7) "Alperen"
[1]=>
string(6) "Sancak"
["surname"]=>
string(6) "Sancak"
[2]=>
int(15)
["age"]=>
int(15)
}
}
```
#
#### Update:
```php
SqlConfig::updateTable($this->sqlconfig, "Example", [
"name" => "Ahmet Eren",
"surname" => "Sancak"
], [
"name" => "Alperen",
"surname" => "Sancak"
]);
```
#
#### Table Data List:
```php
$result = SqlConfig::getTableDataList($this->sqlconfig, "Example");
var_dump($result);
```
##### Result:
```console
array(1) {
["Test"]=>
array(3) {
["Row Count"]=>
int(2)
["Column Count"]=>
int(3)
["Columns Name"]=>
array(4) {
[0]=>
string(4) "name"
[1]=>
string(7) "surname"
[2]=>
string(3) "age"
[3]=>
bool(false)
}
}
}
```
-> [Example Plugin Class](https://github.com/ByAlperenS/SqlConfig/blob/master/example/Test.php).