ApixClient singleton in your
Laravel application. Use the AvraAPI Facade for concise application code or
inject ApixClient where explicit dependencies are clearer. Both patterns use
the same client and return the same response objects.
Facade
Use
AvraAPI::currency(), AvraAPI::security(), and the other service
accessors in a controller, job, command, or service class.Dependency injection
Type-hint
Avraapi\Apix\ApixClient when a class should declare its
AvraAPI dependency explicitly.Requirements
The current Laravel SDK release is 1.2.0. Composer installs its official
PHP SDK
^1.5.2 dependency automatically.
Install the package
Run Composer from the root of your Laravel application:AvraApiServiceProvider and the
AvraAPI alias. Do not add the provider or alias manually to config/app.php.
Configure project credentials
The package merges its configuration defaults automatically. Publish an application-ownedconfig/avraapi.php file only when you want to inspect or
customise those settings:
.env
file. APIX_PROJECT_KEY is the Project Client ID and APIX_API_SECRET is its
matching Client Secret.
.env
development becomes dev and production becomes prod. The package
defaults to production, so set APIX_ENV=development deliberately when
working with a Development project.
Keep the standard base URL for production. After changing
.env values on a
cached deployment, rebuild or clear that deployment’s Laravel configuration
cache before it accepts new requests.
Use the Facade
Import the Facade in backend application code. Laravel resolves the shared configured client; do not construct a new client for every request.Use the AvraAPI Facade in a controller
AvraAPI available to Laravel. Importing
Avraapi\Laravel\Facades\AvraAPI keeps the dependency explicit for IDEs and
static analysis.
Use dependency injection
InjectAvraapi\Apix\ApixClient when a class should declare its dependency.
It and the Facade resolve the same singleton.
Inject the configured client
Read a JSON response
Most provider operations returnApiResponse. The operation result is in
data; retain requestId in support records without retaining sensitive
provider payloads.
Read an ApiResponse
Return generated media from a controller
Utilities can returnBinaryResponse for PNG, SVG, or PDF output. Return its
body with its content type. A utility configured for Base64 returns
ApiResponse instead.
Return a generated QR image
isPdf(), isPng(), or isSvg() before selecting a media-specific
workflow. The Laravel Utility guide documents
the underlying output choices and response modes.
Use Privacy Mode for one provider request
All provider services inheritwithPrivacyMode(). It sends
X-Privacy-Mode: 1 for the next request only and then clears automatically.
Enable Privacy Mode for the next Security request
AvraAPI::call() method does not
offer this fluent control.
lookupIp(..., privacyMode: true) and the Utilities privacyMode: true
arguments remain supported and use the same header. Prefer
withPrivacyMode() for a consistent one-request style.Handle errors safely
The Laravel package preserves the PHP SDK’s typed exceptions. Catch a specific exception where your application has a recovery path, then useApixException as the safe fallback.
Map an SDK failure to a Laravel response
Universal Payment Gateway
The Laravel SDK exposes the server-side UPG service throughAvraAPI::payment() or an injected ApixClient. It uses the same typed
options and result objects as the PHP SDK. Your application still owns pending
orders, idempotency, callback routes, fulfilment, and final business decisions.
Universal Payment Gateway documentation
Follow the canonical checkout lifecycle, Payment Elements, completion, and
gateway-specific guides. Do not invent Laravel-specific payment routes,
events, jobs, or queues that the SDK does not provide.
Next steps
REST API Reference
Review provider request and response contracts.
Universal Payment Gateway
Build a server-authoritative payment integration.
