PHPackages                             dilnaka/dilnaka - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. dilnaka/dilnaka

ActiveLibrary[File &amp; Storage](/categories/file-storage)

dilnaka/dilnaka
===============

PHP SDK for Dilnaka file uploads

v0.0.2(3w ago)04MITPHPPHP ^8.1

Since Jul 14Pushed 3w agoCompare

[ Source](https://github.com/TheSteelNinjaCode/dilnaka-php-sdk)[ Packagist](https://packagist.org/packages/dilnaka/dilnaka)[ Docs](https://dilnaka.storage.tsnc.tech)[ RSS](/packages/dilnaka-dilnaka/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Dilnaka PHP SDK
===============

[](#dilnaka-php-sdk)

PHP SDK for uploading files through the Dilnaka Upload API.

The SDK reads configuration from explicit constructor options first, then environment variables. It requests a presigned S3 upload URL from your Dilnaka backend, uploads the file directly to S3, and calls the completion endpoint. The Dilnaka API base URL is fixed internally to `https://dilnaka.storage.tsnc.tech`.

Small files use a single presigned `PUT`. Large files (at or above `multipartThreshold`, 100 MB by default) automatically use a resumable S3 multipart upload that streams the file in chunks and retries a failed part instead of discarding the whole transfer.

Install
-------

[](#install)

```
composer require dilnaka/dilnaka
```

Configure
---------

[](#configure)

You can pass configuration directly to `new Dilnaka(...)`, or set environment variables for your application.

Configuration precedence is:

1. Explicit constructor options such as `new Dilnaka(['apiKey' => '...'])`
2. Existing process environment variables such as `DILNAKA_API_KEY`
3. Values loaded from `.env`
4. Built-in defaults

If you use a `.env` file, create it in your application project:

```
DILNAKA_API_KEY=dlk_dev_your_api_key_here
DILNAKA_TIMEOUT=60
DILNAKA_MULTIPART_THRESHOLD=104857600
DILNAKA_UPLOAD_TIMEOUT=300
```

The SDK always uses `https://dilnaka.storage.tsnc.tech` as its API base URL.

- `DILNAKA_TIMEOUT` (default `60`): timeout in seconds for JSON API calls (presign, complete, list, etc.).
- `DILNAKA_MULTIPART_THRESHOLD` (default `104857600`, i.e. 100 MB): files at or above this size use the multipart flow.
- `DILNAKA_UPLOAD_TIMEOUT` (default `300`): per-request transfer timeout in seconds for the single `PUT` or each multipart part. This is deliberately larger than `DILNAKA_TIMEOUT` so large chunks over slow links do not time out.

Basic upload
------------

[](#basic-upload)

```
