PHPackages                             vizyontech/bizimhesap-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. vizyontech/bizimhesap-laravel

ActiveLibrary[API Development](/categories/api)

vizyontech/bizimhesap-laravel
=============================

Laravel package for Bizimhesap API integration

152PHP

Since Sep 16Pushed 9mo agoCompare

[ Source](https://github.com/sitesepetim/bizimhesap-laravel)[ Packagist](https://packagist.org/packages/vizyontech/bizimhesap-laravel)[ RSS](/packages/vizyontech-bizimhesap-laravel/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Bizimhesap Laravel Paketi
=========================

[](#bizimhesap-laravel-paketi)

Laravel için Bizimhesap API entegrasyonu. Fatura oluşturma, ürün yönetimi, depo takibi ve stok senkronizasyonu için eksiksiz bir çözüm.

Özellikler
----------

[](#özellikler)

- ✅ Fatura oluşturma (Satış &amp; Alış)
- ✅ Ürün listesi ve arama
- ✅ Depo yönetimi
- ✅ Stok takibi
- ✅ Otomatik yeniden deneme mekanizması
- ✅ Kapsamlı hata yönetimi
- ✅ Laravel Facade desteği
- ✅ Test coverage

Gereksinimler
-------------

[](#gereksinimler)

- PHP 8.0 veya üstü
- Laravel 8.x, 9.x, 10.x veya 11.x
- Bizimhesap API erişim bilgileri

Kurulum
-------

[](#kurulum)

### 1. Paket Kurulumu

[](#1-paket-kurulumu)

**Seçenek A: Packagist'ten kurulum (Önerilen)**

```
composer require vizyontech/bizimhesap-laravel
```

**Seçenek B: GitHub'dan direkt kurulum**

```
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/vizyontech/bizimhesap-laravel.git"
        }
    ],
    "require": {
        "vizyontech/bizimhesap-laravel": "^1.0"
    }
}
```

**Seçenek C: Local path (sadece bu proje için)**

```
{
    "repositories": [
        {
            "type": "path",
            "url": "./packages/bizimhesap-laravel"
        }
    ],
    "require": {
        "vizyontech/bizimhesap-laravel": "*"
    }
}
```

### 2. Service Provider Kaydı

[](#2-service-provider-kaydı)

Laravel 5.5+ için otomatik keşif aktiftir. Manuel kayıt için `config/app.php`:

```
'providers' => [
    // ...
    VizyonTech\Bizimhesap\BizimhesapServiceProvider::class,
],
```

### 3. Facade Kaydı (Opsiyonel)

[](#3-facade-kaydı-opsiyonel)

```
'aliases' => [
    // ...
    'Bizimhesap' => VizyonTech\Bizimhesap\Facades\Bizimhesap::class,
],
```

### 4. Konfigürasyon

[](#4-konfigürasyon)

Config dosyasını publish edin:

```
php artisan vendor:publish --tag=bizimhesap-config
```

`.env` dosyanıza API bilgilerinizi ekleyin:

```
BIZIMHESAP_TOKEN=your-account-token-here
BIZIMHESAP_FIRM_ID=your-firm-id-here
BIZIMHESAP_DEBUG=false
```

Konfigürasyon
-------------

[](#konfigürasyon)

### Temel Ayarlar

[](#temel-ayarlar)

```
// config/bizimhesap.php

return [
    // Sabit API key (Bizimhesap tarafından belirtilen)
    'api_key' => env('BIZIMHESAP_API_KEY', 'BZMHB2B724018943908D0B82491F203F'),

    // Hesabınıza özel token
    'token' => env('BIZIMHESAP_TOKEN', ''),

    // Bizimhesap tarafından verilen firma ID
    'firm_id' => env('BIZIMHESAP_FIRM_ID', ''),

    // API base URL
    'base_url' => env('BIZIMHESAP_BASE_URL', 'https://bizimhesap.com/api/b2b'),

    // İstek timeout süresi (saniye)
    'timeout' => env('BIZIMHESAP_TIMEOUT', 30),

    // Debug modu
    'debug' => env('BIZIMHESAP_DEBUG', false),

    // Yeniden deneme ayarları
    'retry' => [
        'times' => env('BIZIMHESAP_RETRY_TIMES', 3),
        'sleep' => env('BIZIMHESAP_RETRY_SLEEP', 100), // milisaniye
    ],

    // Varsayılan değerler
    'defaults' => [
        'currency' => 'TL',
        'invoice_type' => [
            'sales' => 3,
            'purchase' => 5,
        ],
    ],

    // Desteklenen para birimleri
    'currencies' => ['TL', 'USD', 'EUR', 'CHF', 'GBP'],
];
```

Kullanım
--------

[](#kullanım)

### Facade ile Kullanım

[](#facade-ile-kullanım)

```
use Bizimhesap;
use Carbon\Carbon;

// Satış faturası oluştur
$invoice = Bizimhesap::invoice()->createSalesInvoice([
    'invoiceNo' => 'INV-001',
    'dates' => [
        'invoiceDate' => Carbon::now(),
        'dueDate' => Carbon::now()->addDays(15),
    ],
    'customer' => [
        'customerId' => '123',
        'title' => 'Müşteri Adı',
        'address' => 'Müşteri Adresi',
        'taxNo' => '1234567890'
    ],
    'details' => [
        [
            'productId' => 'P001',
            'productName' => 'Ürün Adı',
            'quantity' => 2,
            'unitPrice' => 100,
            'taxRate' => 18,
            // Diğer alanlar otomatik hesaplanır
        ]
    ],
    'amounts' => [
        'currency' => 'TL',
        // Toplamlar otomatik hesaplanır
    ]
]);

// Tüm ürünleri getir
$products = Bizimhesap::products()->all();

// Tüm depoları getir
$warehouses = Bizimhesap::warehouses()->all();

// Belirli depo için stok bilgisi
$inventory = Bizimhesap::inventory()->getByWarehouse('warehouse-id');
```

### Dependency Injection ile Kullanım

[](#dependency-injection-ile-kullanım)

```
use VizyonTech\Bizimhesap\Services\InvoiceService;

class InvoiceController extends Controller
{
    public function __construct(
        protected InvoiceService $invoiceService
    ) {}

    public function store(Request $request)
    {
        $invoice = $this->invoiceService->create($request->validated());
        return response()->json($invoice);
    }
}
```

### Fatura Toplamları Hesaplama

[](#fatura-toplamları-hesaplama)

```
$lineItems = [
    ['quantity' => 2, 'unitPrice' => 100, 'discount' => 10, 'taxRate' => 18],
    ['quantity' => 1, 'unitPrice' => 50, 'discount' => 0, 'taxRate' => 18]
];

$totals = Bizimhesap::invoice()->calculateTotals($lineItems);
// Döner: ['gross' => 250, 'discount' => 10, 'net' => 240, 'tax' => 43.2, 'total' => 283.2]
```

### Ürün İşlemleri

[](#ürün-i̇şlemleri)

```
// Ürün arama
$products = Bizimhesap::products()->search('laptop');

// Barkod ile ürün bulma
$product = Bizimhesap::products()->findByBarcode('8690123456789');

// ID ile ürün bulma
$product = Bizimhesap::products()->find('product-id');
```

### Stok Yönetimi

[](#stok-yönetimi)

```
// Stok kontrolü
$hasStock = Bizimhesap::inventory()->isInStock('warehouse-id', 'product-id', 5);

// Düşük stok ürünleri
$lowStock = Bizimhesap::inventory()->getLowStockItems('warehouse-id', 10);

// Tüm depolar arası toplam stok
$totalStock = Bizimhesap::inventory()->getTotalStock('product-id');

// Belirli ürün stoğu
$stock = Bizimhesap::inventory()->getStock('warehouse-id', 'product-id');
echo $stock->available; // Mevcut stok
echo $stock->reserved;  // Rezerve stok
echo $stock->quantity;  // Toplam stok
```

### Depo İşlemleri

[](#depo-i̇şlemleri)

```
// Varsayılan depo
$defaultWarehouse = Bizimhesap::warehouses()->getDefault();

// ID ile depo bulma
$warehouse = Bizimhesap::warehouses()->find('warehouse-id');

// Depo görüntü adı
echo $warehouse->getDisplayName();
```

Hata Yönetimi
-------------

[](#hata-yönetimi)

Paket özel exception türleri sağlar:

```
use VizyonTech\Bizimhesap\Exceptions\{
    AuthenticationException,
    ValidationException,
    ApiException
};

try {
    $invoice = Bizimhesap::invoice()->create($data);
} catch (AuthenticationException $e) {
    // Kimlik doğrulama hataları
    logger()->error('Bizimhesap auth error: ' . $e->getMessage());
} catch (ValidationException $e) {
    // Doğrulama hataları
    $errors = $e->getErrors();
    return response()->json(['errors' => $errors], 422);
} catch (ApiException $e) {
    // Genel API hataları
    $statusCode = $e->getStatusCode();
    logger()->error('Bizimhesap API error: ' . $e->getMessage());
}
```

Model Sınıfları
---------------

[](#model-sınıfları)

### Invoice Model

[](#invoice-model)

```
$invoice = new VizyonTech\Bizimhesap\Models\Invoice($data);

// Fatura türü kontrolleri
$invoice->isSales();     // true/false
$invoice->isPurchase();  // true/false
$invoice->getTypeName(); // 'Sales', 'Purchase', 'Unknown'

// Fatura bilgileri
$invoice->getTotal();        // float
$invoice->getCurrency();     // string
$invoice->getCustomerName(); // string

// Array'e çevir
$array = $invoice->toArray();
```

### Product Model

[](#product-model)

```
$product = new VizyonTech\Bizimhesap\Models\Product($data);

// Ürün bilgileri
$product->getDisplayName();     // Görüntü adı
$product->getPriceWithTax();    // KDV dahil fiyat
$product->getTaxAmount();       // KDV tutarı

// Array'e çevir
$array = $product->toArray();
```

### Inventory Model

[](#inventory-model)

```
$inventory = new VizyonTech\Bizimhesap\Models\Inventory($data);

// Stok kontrolleri
$inventory->isInStock(5);    // 5 adet stok var mı?
$inventory->isLowStock();    // Düşük stok mu?
$inventory->isOverStock();   // Fazla stok mu?
$inventory->getStatus();     // 'in-stock', 'low-stock', 'out-of-stock', 'over-stock'

// Array'e çevir
$array = $inventory->toArray();
```

Web Arayüzü
-----------

[](#web-arayüzü)

Paket, web tabanlı yönetim arayüzü ile gelir:

### Entegrasyon Yönetimi

[](#entegrasyon-yönetimi)

```
https://yourdomain.com/entegrasyon/bizimhesap

```

Özellikler:

- API ayarları yapılandırması
- Bağlantı testi
- Ürün senkronizasyonu
- İşlem logları görüntüleme
- Otomatik senkronizasyon ayarları

### API Ayarları

[](#api-ayarları)

- **Token**: Bizimhesap hesabınızdan alacağınız API token
- **Firma ID**: Bizimhesap hesabınızdaki firma ID'si
- **Test Modu**: Geliştirme ortamı için test modu
- **Debug Modu**: Detaylı log kayıtları
- **Otomatik Senkronizasyon**: Ürün, stok ve fatura otomasyonu

Veritabanı Tabloları
--------------------

[](#veritabanı-tabloları)

Paket aşağıdaki tabloları oluşturur:

### bizimhesap\_settings

[](#bizimhesap_settings)

Entegrasyon ayarlarını saklar.

### bizimhesap\_sync\_logs

[](#bizimhesap_sync_logs)

Senkronizasyon işlemlerini loglar.

### bizimhesap\_product\_mappings

[](#bizimhesap_product_mappings)

Lokal ürünler ile Bizimhesap ürünlerini eşleştirir.

### bizimhesap\_warehouse\_mappings

[](#bizimhesap_warehouse_mappings)

Lokal depolar ile Bizimhesap depolarını eşleştirir.

API Sınırlamaları
-----------------

[](#api-sınırlamaları)

⚠️ **Önemli**: Bizimhesap API'sinin bilinen sınırlamaları:

- Sadece GET ve POST metodları desteklenir
- UPDATE veya DELETE işlemleri yok
- Sınırlı response formatı dokümantasyonu
- Resmi rate limiting bilgisi yok
- Dokümantasyon eski (5+ yıl)

Pratik Kullanım Örnekleri
-------------------------

[](#pratik-kullanım-örnekleri)

### Sipariş'ten Fatura Oluşturma

[](#siparişten-fatura-oluşturma)

```
class InvoiceController extends Controller
{
    public function createFromOrder(Order $order)
    {
        // Sipariş kalemlerini hazırla
        $lineItems = $order->items->map(function ($item) {
            return [
                'productId' => $item->product_id,
                'productName' => $item->product_name,
                'quantity' => $item->quantity,
                'unitPrice' => $item->price,
                'taxRate' => $item->tax_rate ?? 18,
                'discount' => (string) $item->discount,
            ];
        })->toArray();

        // Toplamları otomatik hesapla
        $totals = Bizimhesap::invoice()->calculateTotals($lineItems);

        // Fatura oluştur
        $invoiceData = [
            'invoiceNo' => $order->invoice_number,
            'dates' => [
                'invoiceDate' => Carbon::now(),
                'dueDate' => Carbon::now()->addDays(30),
                'deliveryDate' => $order->delivery_date,
            ],
            'customer' => [
                'customerId' => $order->customer->id,
                'title' => $order->customer->name,
                'address' => $order->customer->address,
                'taxNo' => $order->customer->tax_number,
            ],
            'details' => array_map(function ($item, $index) use ($lineItems) {
                $lineItem = $lineItems[$index];
                $grossPrice = $lineItem['quantity'] * $lineItem['unitPrice'];
                $discount = (float) $lineItem['discount'];
                $net = $grossPrice - $discount;
                $tax = $net * ($lineItem['taxRate'] / 100);

                return array_merge($lineItem, [
                    'grossPrice' => $grossPrice,
                    'net' => $net,
                    'tax' => $tax,
                    'total' => $net + $tax,
                ]);
            }, $lineItems, array_keys($lineItems)),
            'amounts' => array_merge($totals, [
                'currency' => $order->currency ?? 'TL',
            ]),
        ];

        try {
            $response = Bizimhesap::invoice()->create($invoiceData);

            // Bizimhesap fatura ID'sini siparişe kaydet
            $order->update([
                'bizimhesap_invoice_id' => $response['id'] ?? null,
                'invoice_created_at' => now(),
            ]);

            return response()->json([
                'success' => true,
                'message' => 'Fatura başarıyla oluşturuldu',
                'data' => $response
            ]);

        } catch (\Exception $e) {
            \Log::error('Bizimhesap fatura oluşturma hatası', [
                'order_id' => $order->id,
                'error' => $e->getMessage()
            ]);

            return response()->json([
                'success' => false,
                'message' => 'Fatura oluşturulamadı',
                'error' => $e->getMessage()
            ], 422);
        }
    }
}
```

### Stok Kontrolü Servisi

[](#stok-kontrolü-servisi)

```
class StockService
{
    public function checkAvailability(array $items, string $warehouseId = null)
    {
        if (!$warehouseId) {
            $warehouseId = Bizimhesap::warehouses()->getDefault()?->id;
        }

        $availability = [];

        foreach ($items as $item) {
            $stock = Bizimhesap::inventory()->getStock($warehouseId, $item['product_id']);

            $availability[] = [
                'product_id' => $item['product_id'],
                'requested' => $item['quantity'],
                'available' => $stock?->available ?? 0,
                'in_stock' => $stock?->isInStock($item['quantity']) ?? false,
            ];
        }

        return [
            'warehouse_id' => $warehouseId,
            'items' => $availability,
            'all_available' => collect($availability)->every('in_stock'),
        ];
    }
}
```

Test Etme
---------

[](#test-etme)

```
vendor/bin/phpunit
```

Güvenlik
--------

[](#güvenlik)

Güvenlik açıkları bulursanız, lütfen  adresine e-posta gönderin.

Lisans
------

[](#lisans)

MIT Lisansı. Detaylar için [LICENSE](LICENSE) dosyasına bakın.

Değişiklik Geçmişi
------------------

[](#değişiklik-geçmişi)

Tüm önemli değişiklikler [CHANGELOG.md](CHANGELOG.md) dosyasında belgelenmiştir.

Katkıda Bulunma
---------------

[](#katkıda-bulunma)

Katkılarınızı memnuniyetle karşılıyoruz! Lütfen katkıda bulunmadan önce [CONTRIBUTING.md](CONTRIBUTING.md) dosyasını okuyun.

Destek
------

[](#destek)

Sorularınız için:

- GitHub Issues: Teknik sorunlar ve bug raporları
- E-posta:
- Bizimhesap Desteği:  - (0216) 706 06 60

Ek Kaynaklar
------------

[](#ek-kaynaklar)

- [Bizimhesap Resmi Sitesi](https://bizimhesap.com/)
- [Laravel Dokümantasyonu](https://laravel.com/docs)
- [Vizyon Tech Yazılım](https://vizyontechyazilim.com/)

---

**Not**: Bu paket, Bizimhesap API'sinin **mevcut sınırlamaları** göz önüne alınarak hazırlanmıştır. API'nin eksik dokümantasyonu nedeniyle, response formatları ve bazı özellikler tahmine dayalı olarak implement edilmiştir. Production kullanımı için **Bizimhesap teknik desteği** ile iletişime geçerek güncel dokümantasyon talep edilmesi önerilir.

Paket, Laravel'in best practice'lerine uygun şekilde tasarlanmış olup, **genişletilebilir** ve **test edilebilir** bir yapıya sahiptir. API güncellemeleri durumunda kolayca adapte edilebilir.

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance40

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/84999348?v=4)[Vizyontech Yazılım](/maintainers/sitesepetim)[@sitesepetim](https://github.com/sitesepetim)

---

Top Contributors

[![sitesepetim](https://avatars.githubusercontent.com/u/84999348?v=4)](https://github.com/sitesepetim "sitesepetim (1 commits)")

### Embed Badge

![Health badge](/badges/vizyontech-bizimhesap-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/vizyontech-bizimhesap-laravel/health.svg)](https://phpackages.com/packages/vizyontech-bizimhesap-laravel)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
