Skip to content
This repository was archived by the owner on Jul 18, 2024. It is now read-only.

Commit 5701d9f

Browse files
committed
first commit
0 parents  commit 5701d9f

9 files changed

Lines changed: 815 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor

README.md

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# 💸 İnteraktif Vergi Dairesi
2+
3+
GİB İnteraktif Vergi Dairesi üzerinden şifresiz/şifreli işlemlere olanak tanır.
4+
5+
- https://ivd.gib.gov.tr
6+
7+
## Kurulum
8+
9+
🛠️ Paketi composer ile projenize dahil edin;
10+
11+
```bash
12+
composer require mlevent/ivd
13+
```
14+
15+
## Kullanım
16+
17+
```php
18+
use Mlevent\Ivd\IvdException;
19+
use Mlevent\Ivd\IvdService;
20+
21+
try {
22+
23+
// Şifresiz Giriş
24+
$ivd = (new IvdService)->login();
25+
26+
// Vergi Numarası Doğrulama
27+
$result = $ivd->taxIdVerification(
28+
trId : '11111111111',
29+
province : '016',
30+
taxOffice : '016252'
31+
);
32+
33+
print_r($result);
34+
35+
// Oturumu Sonlandır
36+
$ivd->logout();
37+
38+
} catch(IvdException $e){
39+
40+
print_r($e->getMessage());
41+
print_r($e->getResponse());
42+
print_r($e->getRequest());
43+
}
44+
```
45+
46+
### Gerçek Kullanıcı
47+
48+
Kullanıcı bilgilerinizi `setCredentials` ya da `login` metoduyla tanımlayabilirsiniz.
49+
50+
```php
51+
use Mlevent\Ivd\IvdService;
52+
53+
// Kullanıcı Bilgileriyle Giriş
54+
$ivd = (new IvdService)->login('TC Kimlik No', 'Parola');
55+
56+
// Şirketlerdeki Ortaklık ve Yöneticilik Bilgileri
57+
print_r($ivd->getPartnerships());
58+
```
59+
60+
> Not: Token değerini herhangi bir yerde kullanmanız gerekmeyecek.
61+
62+
## Şifresiz İşlemler
63+
64+
İnteraktif Vergi Dairesi üzerindeki bazı servisler şifresiz/giriş yapmadan kullanılabilir;
65+
66+
#### Vergi Kimlik Numarası Sorgulama
67+
68+
```php
69+
$result = $ivd->taxIdInquiry(
70+
name : 'Mert', // Zorunlu · Ad
71+
lastName : 'Levent', // Zorunlu · Soyad
72+
fatherName : 'Walter', // Zorunlu · Baba Adı
73+
province : '016', // Zorunlu · İl
74+
dateOfBirth : '19890511' // Zorunlu · Doğum Tarihi
75+
);
76+
77+
print_r($result);
78+
```
79+
80+
#### Yabancılar İçin Vergi Kimlik Numarasından Sorgulama
81+
82+
```php
83+
$result = $ivd->taxIdInquiryForForeigners(
84+
taxId : '1234567890' // Zorunlu · Vergi Numarası
85+
);
86+
87+
print_r($result);
88+
```
89+
90+
#### Vergi Kimlik Numarası Doğrulama
91+
92+
```php
93+
$result = $ivd->taxIdVerification(
94+
//taxId : '1234567890', // Opsiyonel · Vergi Numarası
95+
trId : '11111111111', // Opsiyonel · TcKN
96+
province : '016', // Zorunlu · İl
97+
taxOffice : '016252' // Zorunlu · Vergi Dairesi
98+
);
99+
100+
print_r($result);
101+
```
102+
103+
#### Diğer Metodlar
104+
105+
```php
106+
print_r($ivd->getTaxOffices()); // Vergi Daireleri
107+
print_r($ivd->getTaxList()); // Vergiler
108+
print_r($ivd->getCountries()); // Ülkeler
109+
print_r($ivd->getProvinces()); // İller
110+
print_r($ivd->getProvincesAndDistricts()); // İller ve İlçeler
111+
```
112+
113+
## Şifreli İşlemler
114+
115+
İnteraktif Vergi Dairesinde kayıtlı TcKN ve şifre bilgileriyle oturum açılarak kullanılabilecek metodlar;
116+
117+
#### Sicil Kaydı
118+
119+
```php
120+
$ivd->getRegistry();
121+
```
122+
123+
#### Kimlik Bilgileri
124+
125+
```php
126+
$ivd->getIdInformation();
127+
```
128+
129+
#### Şirketlerdeki Ortaklık ve Yöneticilik Bilgileri
130+
131+
```php
132+
$ivd->getPartnerships();
133+
```
134+
135+
#### Borç Durumu
136+
137+
```php
138+
$ivd->getDebtStatus();
139+
```
140+
141+
#### KYK Borç Durumu
142+
143+
```php
144+
$ivd->getKYKDebtStatus();
145+
```
146+
147+
#### Banka Hesaplarına Uygulanan Elektronik Hacizler
148+
149+
```php
150+
$ivd->getGarnishmentsAppliedToBankAccounts();
151+
```
152+
153+
#### Araçlara Uygulanan Elektronik Hacizler
154+
155+
```php
156+
$ivd->getGarnishmentsAppliedToVehicles();
157+
```
158+
159+
#### Mevcut Araç Bilgileri
160+
161+
```php
162+
$ivd->getCurrentVehicles();
163+
```
164+
165+
#### Geçmiş Araç Bilgileri
166+
167+
```php
168+
$ivd->getPreviousVehicles();
169+
```
170+
171+
#### Vergi Ceza İhbarname Bilgileri
172+
173+
```php
174+
$ivd->getTaxPenaltyNoticeInformation();
175+
```
176+
177+
#### Sanal Pos Ödemeleri
178+
179+
```php
180+
$ivd->getVirtualPosPayments(
181+
year: 2018 // Zorunlu · Yıl
182+
);
183+
```
184+
185+
#### E-Devlet Ödemeleri
186+
187+
```php
188+
$ivd->getEDevletPayments(
189+
year: 2018 // Zorunlu · Yıl
190+
);
191+
```
192+
193+
#### Diğer Ödemeler
194+
195+
```php
196+
$ivd->getOtherPayments(
197+
year: 2018 // Zorunlu · Yıl
198+
);
199+
```
200+
201+
#### Servis Mesajları
202+
203+
```php
204+
$ivd->getServiceMessages();
205+
```
206+
207+
## 📧İletişim
208+
209+
İletişim için ghergedan@gmail.com adresine e-posta gönderin.

composer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "mlevent/ivd",
3+
"description": "İnternet Vergi Dairesi Yardımcı Aracı",
4+
"keywords": [
5+
"gib",
6+
"ivd",
7+
"interaktif vergi dairesi",
8+
"maliye",
9+
"vergi"
10+
],
11+
"autoload": {
12+
"psr-4": {
13+
"Mlevent\\Ivd\\": "src/"
14+
}
15+
},
16+
"authors": [
17+
{
18+
"name": "mlevent",
19+
"email": "ghergedan@gmail.com"
20+
}
21+
],
22+
"require": {
23+
"php": "^8.0"
24+
},
25+
"minimum-stability": "dev",
26+
"prefer-stable": true
27+
}

composer.lock

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/index.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types=1); error_reporting(E_ALL); require dirname(__DIR__).'/vendor/autoload.php';
2+
3+
use Mlevent\Ivd\IvdException;
4+
use Mlevent\Ivd\IvdService;
5+
6+
try {
7+
8+
$ivd = (new IvdService())->login();
9+
10+
var_dump($ivd->getTaxList());
11+
12+
$ivd->logout();
13+
14+
} catch(IvdException $e){
15+
16+
print_r($e->getMessage());
17+
print_r($e->getResponse());
18+
print_r($e->getRequest());
19+
}

src/Autoload.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
spl_autoload_register(
4+
function ($class) {
5+
// project-specific namespace prefix. Will only kicks in for Mlevent namespace.
6+
$prefix = 'Mlevent\\';
7+
8+
// base directory for the namespace prefix.
9+
$base_dir = __DIR__; // By default, it points to this same folder.
10+
// You may change this path if having trouble detecting the path to
11+
// the source files.
12+
13+
// does the class use the namespace prefix?
14+
$len = strlen($prefix);
15+
if (strncmp($prefix, $class, $len) !== 0) {
16+
// no, move to the next registered autoloader.
17+
return;
18+
}
19+
20+
// get the relative class name.
21+
$relative_class = substr($class, $len);
22+
23+
// replace the namespace prefix with the base directory, replace namespace
24+
// separators with directory separators in the relative class name, append
25+
// with .php
26+
$file = $base_dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php';
27+
28+
// if the file exists, require it
29+
if (file_exists($file)) {
30+
require $file;
31+
}
32+
}
33+
);

src/IvdException.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Mlevent\Ivd;
6+
7+
use Exception;
8+
9+
class IvdException extends Exception
10+
{
11+
/**
12+
* @var array
13+
*/
14+
private $request;
15+
16+
/**
17+
* @var array
18+
*/
19+
private $response;
20+
21+
public function __construct(
22+
string $message = null,
23+
mixed $request = null,
24+
mixed $response = null,
25+
int $code = 0,
26+
Exception $previous = null,
27+
) {
28+
parent::__construct($message, $code, $previous);
29+
$this->response = $response;
30+
$this->request = $request;
31+
}
32+
33+
/**
34+
* getResponse
35+
*
36+
* @return mixed
37+
*/
38+
public function getResponse(): mixed
39+
{
40+
return $this->response;
41+
}
42+
43+
/**
44+
* hasResponse
45+
*
46+
* @return boolean
47+
*/
48+
public function hasResponse(): bool
49+
{
50+
return $this->response !== null;
51+
}
52+
53+
/**
54+
* getRequest
55+
*
56+
* @return mixed
57+
*/
58+
public function getRequest(): mixed
59+
{
60+
return $this->request;
61+
}
62+
}

0 commit comments

Comments
 (0)