Tiger_Media_Storage_Filesystem

@api Β· implements Tiger_Media_Storage_Interface

Tiger_Media_Storage_Filesystem β€” local-disk media storage.

Two roots (both resolved relative to APPLICATION_ROOT so config stays portable):

  • PUBLIC files under the docroot (public_root, e.g. public/_media) β†’ served directly at public_url with no PHP in the path.
  • PRIVATE files OUTSIDE the docroot (private_root, e.g. storage/media) β†’ not web-reachable; url() returns '' so the media layer streams them through the ACL-checked /media/file/ route.

Keys are relative paths; the adapter refuses .. traversal.

Methods

__construct()

__construct(array $config)

Resolve the public/private roots and public URL base from the disk config.

  • $config array β€” the media.disks.<name>.* settings

put()

put($key, $sourcePath, $visibility, $mime = null)

Store bytes from a source file path (copies the file to its target).

  • $key string β€” the adapter-relative storage key
  • $sourcePath string β€” the source file on disk to copy from
  • $visibility string β€” public|private
  • $mime ?string β€” the content MIME type (unused by this adapter)

Throws RuntimeException β€” when the target can't be written

write()

write($key, $bytes, $visibility, $mime = null)

Store raw bytes to the target file.

  • $key string β€” the adapter-relative storage key
  • $bytes string β€” the raw bytes to store
  • $visibility string β€” public|private
  • $mime ?string β€” the content MIME type (unused by this adapter)

Throws RuntimeException β€” when the target can't be written

get()

get($key, $visibility)

Read all bytes of a file.

  • $key string β€” the adapter-relative storage key
  • $visibility string β€” public|private

Returns string β€” the file's bytes

Throws RuntimeException β€” when the file is not found

stream()

stream($key, $visibility)

Open a read stream for a file.

  • $key string β€” the adapter-relative storage key
  • $visibility string β€” public|private

Returns resource β€” a readable file handle

Throws RuntimeException β€” when the file is not found

delete()

delete($key, $visibility)

Remove a file (idempotent β€” a missing file is not an error).

  • $key string β€” the adapter-relative storage key
  • $visibility string β€” public|private

exists()

exists($key, $visibility)

Does the file exist?

  • $key string β€” the adapter-relative storage key
  • $visibility string β€” public|private

Returns bool β€” true when the file exists

size()

size($key, $visibility)

Size of a file in bytes (0 if missing).

  • $key string β€” the adapter-relative storage key
  • $visibility string β€” public|private

Returns int β€” the file size in bytes, or 0 if missing

url()

url($key, $visibility, $ttl = null)

A directly-usable URL for a file (a docroot URL for public; '' for private).

  • $key string β€” the adapter-relative storage key
  • $visibility string β€” public|private
  • $ttl ?int β€” unused by this adapter (no signed URLs)

Returns string β€” a public URL, or '' when the app must stream the bytes itself