furkankadioglu/efatura
Laravel package for Turkish e-Fatura integration. Create, sign, and send UBL-TR electronic invoices to the GİB portal through a simple, fluent API, with easy configuration and XML output for PHP applications.
composer require <vendor>/<package> and publish the config: php artisan vendor:publish --tag=<package>-config. The published config file is the first thing to read — it holds credentials, endpoint/URL selection, and the test_mode / test-account switches that 1.9.4 touched.config/services.php (or the package config) and to .env, never hard-coded. Resolve them via config() so php artisan config:cache works in production.Facade). Prefer constructor-injecting the contract/interface over the facade so the code stays testable.adımıza düzenlenen faturalar). Wire it into a php artisan tinker session or a one-off command first — it is read-only, so it is the safest way to validate credentials and endpoint configuration before touching money flows.Wrap the package, don't sprinkle it. Create a small application-level service (App\Services\Payments\Gateway) that takes the package client in its constructor and exposes your domain verbs: startPayment(), confirm(), invoicesForPeriod(). When the package inevitably changes its method signatures, you patch one class instead of forty controllers.
SMS confirmation callback flow
web middleware group (or explicitly withoutMiddleware(VerifyCsrfToken::class)). Providers POST cross-origin with no session and no CSRF token.status=success in the POST body.unique index plus firstOrCreate, or a cache lock) so a duplicate callback does not double-fulfil an order.OK or similar). A slow handler that times out triggers retries.Test account override (new in 1.9.4)
config('gateway.test_account') sourced from an env var. That way staging uses the manual test account and production simply has the value unset.TestAccountResolver) rather than passing it around, so you can log centrally which mode is active.AppServiceProvider::boot() that throws in production if a test account is configured. This is the single highest-value line of code around this feature.Invoice querying
App\Data\InvoiceData) and map to your own Eloquent model if you need history. Never let package response objects leak into Blade views or API resources.InvoiceSync command that pages backwards from today, upserts by invoice number/ETTN, and stores the PDF URL. Cache aggressively — invoice data is immutable once issued.Cache::remember keyed on the invoice identifier, not on the date range.Testing
Http::fake() with recorded fixtures from the real sandbox. Record the SMS-confirmation callback body as a fixture too and assert your handler is idempotent by replaying it twice.$this->post(...) and assert the exact response body — providers are strict about it.config:cache bites on deploy. Changing the test-account env var does nothing until the config is re-cached. If "it's still using the test account in production" gets reported, that is the first thing to check."123,45"-style decimal string depending on endpoint — check the package's expectation per call; mixing them silently charges 100×. Store money as integers in your DB and convert only at the boundary.Europe/Istanbul) while your app may be UTC. An off-by-one at month boundaries shows up as a missing invoice, not an error.usleep/RateLimiter, and make the job resumable via a checkpoint column.Macroable trait, or an overridable HTTP client binding — most of what you'd want to change (headers, retries, logging) is usually reachable by rebinding one class in your own service provider.How can I help you explore Laravel packages today?