Skip to main content
Aikeedo stores generated images, uploads and other user-visible files through a CDN abstraction. Administrators choose one adapter under Settings → File storage, and every part of the application uses it. A plugin can add more.

The interface

AdapterInterface extends League\Flysystem\FilesystemAdapter, so your adapter is a Flysystem adapter with three extra methods. In practice you extend an existing Flysystem adapter and add them.

Implementation

This example wraps the S3 adapter, which covers any S3-compatible provider.
composer.json
src/AcmeCloud.php
The constructor runs when the adapter is first resolved, which only happens when it’s the selected backend or when the admin page lists adapters. Building the client there is fine.

Register it

src/Plugin.php
The adapter now appears under Settings → File storage. The administrator’s choice is stored in option.cdn.adapter, and Aikeedo resolves your adapter for every file operation from then on.

Settings page

The storage list links to /admin/settings/cdn/{key}, so declare that route and set extra.default_url to it:
Fields to include: enable toggle, endpoint, region, bucket, access key, secret key, and an optional custom domain for public URLs.

Signed URLs

option.cdn.sign_urls is a global switch. When it’s on, getUrl() must return a time-limited URL, and objects should be written privately. When it’s off, objects that Aikeedo writes with public visibility must be reachable at a stable URL.
Never cache the result of getUrl() beyond the signature’s lifetime, and never store a signed URL in the database. Aikeedo stores the object key and asks the adapter for a URL when it needs one.

Migrating existing files

Changing the adapter doesn’t move existing files: records keep the storage key they were written with. Tell administrators to copy their existing objects to the new backend before switching, or to keep the old backend reachable.

Testing

Generate an image and confirm the file lands in your bucket.
The image displays in the library, which means getUrl() is right.
With URL signing on, URLs expire and are regenerated on the next page load.
Uploading a large file works, and cleanup deletes objects.
Wrong credentials produce a clear error rather than a blank page.

Official storage adapters

The official Cloud Storage plugin already supports the most common S3-compatible providers. It’s available on the Aikeedo Marketplace: