diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4688256 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.lock +index.php \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d5aeb9a --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +## Bestoon php client + +### Install + +you can install client with composer +``` +composer require bestoon/client +``` \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..e0b1562 --- /dev/null +++ b/composer.json @@ -0,0 +1,20 @@ +{ + "name": "bestoon/client", + "description": "Bestoon php client", + "authors": [ + { + "name": "Alireza Josheghani", + "email": "josheghani.dev@gmail.com" + } + ], + "require": { + "php": ">=5.6" + }, + "autoload": { + "psr-4": { + "Bestoon\\": "src/" + } + }, + "minimum-stability": "dev", + "license": "MIT" +} diff --git a/src/Client.php b/src/Client.php new file mode 100644 index 0000000..f433b38 --- /dev/null +++ b/src/Client.php @@ -0,0 +1,87 @@ +token = $options['token']; + } + + /** + * Get stat + * + * @return mixed + */ + public function generalStat() + { + $response = $this->post($this->baseUrl . '/q/generalstat/',[ + 'token' => $this->token + ]); + + return json_decode($response, true); + } + + /** + * Get expense + * + * @param $amount + * @param $text + * @return mixed + */ + public function expense($amount, $text) + { + $response = $this->post($this->baseUrl . '/submit/expense',[ + 'token' => $this->token, + 'amount' => $amount, + 'text' => $text + ]); + + return json_decode($response, true); + } + + /** + * Get income + * + * @param $amount + * @param $text + * @return mixed + */ + public function income($amount, $text) + { + $response = $this->post($this->baseUrl . '/submit/income',[ + 'token' => $this->token, + 'amount' => $amount, + 'text' => $text + ]); + + return json_decode($response, true); + } + +} \ No newline at end of file diff --git a/src/Request.php b/src/Request.php new file mode 100644 index 0000000..a25e5a7 --- /dev/null +++ b/src/Request.php @@ -0,0 +1,35 @@ +