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
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:
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.
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.