Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 59 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
# php-mysql-connectors
# Slvler - php-mysql-connectors

Mysql driver development that can be used on the php side

PHP Mysql Connectors

## Installation

To install this package tou can use composer:

```bash
composer require slvler/mysql-connectors
```

## Usage

Initialize
------------
```php
<?php
define('DBHost', 'localhost');
define('DBName', 'northwind');
define('DBUser', 'root');
define('DBPassword', '');
define("connection","connection");
$db = new DatabaseController(DBHost, DBName, DBUser, DBPassword,connection);

?>

use slvler\mysqlconnectors\Constant;
use slvler\mysqlconnectors\Config\Method;
use slvler\mysqlconnectors\Database\DatabaseController;


$Constant = new Constant();

$db = new DatabaseController($Constant->showDBHost(), $Constant->showDBName(), $Constant->showDBUser(), $Constant->showDBPassword(), $Constant->showConnection());

```


Expand Down Expand Up @@ -51,19 +59,17 @@ $data = Array
);
```

```php
Insert Method
<?php
$methodInsert = $method->Insert($tableName,$data);
?>
```

### Insert Method


```php

#### Update Method (TableName, Id = array() , Data = array()):
$methodInsert = $method->Insert($tableName,$data);

```

#### Update Method (TableName, Id = array() , Data = array()):

TableName, Id , Data:

Expand All @@ -82,19 +88,15 @@ $data = Array
);
```

```php
Update Method
<?php
$methodUpdate = $method->Update($tableName', $id, $data);
?>
```


### Update Method

```php

$methodUpdate = $method->Update($tableName', $id, $data);

```

#### Delete Method (TableName, Id = array()):
### Delete Method (TableName, Id = array()):

TableName, Id:

Expand All @@ -107,34 +109,36 @@ $Id = array(

```

### Delete Method

```php
Delete Method
<?php

$methodDelete = $method->Delete($tableName,$id);
?>

```



#### Select_all Method (TableName):
### Select_all Method (TableName):

TableName:

```php
$tableName = "Orders";
```

### Select_all Method

```php
Select_all Method
<?php

$methodSelectAll = $method->Select_all($tableName);
?>

```




#### Select_ch Method (TableName, Data = array()):
### Select_ch Method (TableName, Data = array()):

TableName, Data:

Expand All @@ -148,11 +152,12 @@ $data = Array

```

### Select_ch Method

```php
Select_ch Method
<?php

$methodSelectCh = $method->Select_ch($tableName,$data);
?>

```


Expand Down Expand Up @@ -180,17 +185,28 @@ $if = Array

```


### Select_wh Method

```php
Select_wh Method
<?php

$methodSelectWh = $method->Select_wh($tableName, $data, $conn, $if);
?>

```



### Testing

```bash
vendor\bin\phpunit
```

## Credits

- [slvler](https://github.com/slvler)


## License

The MIT License (MIT). Please see [License File](https://github.com/slvler/slvler/blob/main/LICENSE.md) for more information.
31 changes: 31 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "slvler/mysql-connectors",
"license": "MIT",
"description": "Mysql driver development that can be used on the php side",
"type": "package",
"authors": [
{
"name": "slvler",
"email": "slvler@proton.me"
}
],
"autoload": {
"psr-4": {
"slvler\\mysqlconnectors\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"slvler\\mysqlconnectors\\Tests\\": "tests/"
}
},
"require": {},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"scripts": {
"test": "vendor/bin/phpunit tests"
},
"minimum-stability": "dev",
"prefer-stable": true
}
30 changes: 30 additions & 0 deletions example/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

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


use slvler\mysqlconnectors\Constant;
use slvler\mysqlconnectors\Config\Method;
use slvler\mysqlconnectors\Database\DatabaseController;


$Constant = new Constant();

$db = new DatabaseController($Constant->showDBHost(), $Constant->showDBName(), $Constant->showDBUser(), $Constant->showDBPassword(), $Constant->showConnection());

$connection = $db->MysqlConnection();
$method = new Method($connection);

$example = $method->Select_all("orders");



$data = array(
'ShipName' => "deneme",
'ShipAddress' => "deneme",
'ShipCity' => "deneme"
);

$method = $method->Insert("orders",$data);

?>
12 changes: 12 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Connection">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
88 changes: 43 additions & 45 deletions src/qwerty/Config/Method.php → src/Config/Method.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
<?php

namespace qwerty\Config;

class Method extends Sql {

public $connection;


public function __construct($connection){
parent::__construct($connection);
}

public function Select_ch($table,$data = array())
{
return parent::Select_ch($table,$data);
}

public function Select_all($table){
return parent::Select_all($table);
}

public function Select_wh($table, $data = array(),$con = array(), $if = array())
{
return parent::Select_wh($table, $data, $con, $if); // TODO: Change the autogenerated stub
}

public function Insert($table, $data = array())
{
return parent::Insert($table, $data); // TODO: Change the autogenerated stub
}

public function Update($table, $id = array(), $data = array())
{
return parent::Update($table, $id, $data); // TODO: Change the autogenerated stub
}
public function Delete($table, $id = array())
{
return parent::Delete($table, $id); // TODO: Change the autogenerated stub
}


}


<?php

namespace slvler\mysqlconnectors\Config;

class Method extends Sql {

public $connection;


public function __construct($connection){
parent::__construct($connection);
}

public function Select_ch($table,$data = array())
{
return parent::Select_ch($table,$data);
}

public function Select_all($table){
return parent::Select_all($table);
}

public function Select_wh($table, $data = array(),$con = array(), $if = array())
{
return parent::Select_wh($table, $data, $con, $if); // TODO: Change the autogenerated stub
}

public function Insert($table, $data = array())
{
return parent::Insert($table, $data); // TODO: Change the autogenerated stub
}

public function Update($table, $id = array(), $data = array())
{
return parent::Update($table, $id, $data); // TODO: Change the autogenerated stub
}
public function Delete($table, $id = array())
{
return parent::Delete($table, $id); // TODO: Change the autogenerated stub
}
}


?>
Loading