Download the PHP package sarkis-sh/spray-media without Composer

On this page you can find all versions of the php package sarkis-sh/spray-media. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package spray-media

Spray Media — Secure, Signed, Developer-First Media for Laravel

Latest Version Laravel PHP

Spray Media gives you signed links, a hardened upload flow, and swappable building blocks so you can ship secure media delivery (view/download) quickly and confidently.

Table of Contents

Why Spray Media

Requirements

Install

Configuration Essentials

Full config lives in src/Config/media.php. Key options:

Key ENV Default Purpose
disk SPRAY_MEDIA_DISK local Filesystem disk from config/filesystems.php
base_dir SPRAY_MEDIA_BASE_DIR uploads Root folder inside the disk
upload.max_kb SPRAY_MEDIA_MAX_UPLOAD_KB 51200 Max size (KB)
upload.mimetypes / upload.mimes SPRAY_MEDIA_MIMETYPES / SPRAY_MEDIA_MIMES image/jpeg,image/png,application/pdf Allowed types
route.prefix SPRAY_MEDIA_ROUTE_PREFIX api/media-items Route group prefix
route.path SPRAY_MEDIA_ROUTE_PATH secure Signed serve endpoint path
route.middleware_public SPRAY_MEDIA_ROUTE_MIDDLEWARE_PUBLIC api Middleware for serve endpoint
route.middleware_admin SPRAY_MEDIA_ROUTE_MIDDLEWARE_ADMIN api Middleware for upload/CRUD
hmac.secret SPRAY_MEDIA_HMAC_SECRET APP_KEY HMAC key
hmac.algorithm SPRAY_MEDIA_HMAC_ALGO sha256 HMAC algo
hmac.default_expiration_minutes SPRAY_MEDIA_DEFAULT_EXPIRATION_MINUTES 60 Default link TTL
performance.cache_control SPRAY_MEDIA_CACHE_CONTROL private, max-age=3600 Cache-Control header
performance.enable_etag SPRAY_MEDIA_ENABLE_ETAG true Add ETag

Default Routes

Defined in src/Routes/api.php (prefix/path/middleware are configurable):

HTTP Path Description Middleware
GET /api/media-items/secure Serve signed file (view/download) route.middleware_public
POST /api/media-items Upload file + create record route.middleware_admin
PUT /api/media-items/{id}/update-filename Update filename only route.middleware_admin
DELETE /api/media-items/{id} Delete file + record route.middleware_admin

Update filename endpoint

Example:

Database Schema

Migration: src/Database/Migrations/0001_01_01_000003_create_media_items_table.php

Quickstart (3 Steps)

1) Upload via HTTP

Validation applies max/mime/mimetypes/custom_rules from config.

Sample success payload (see src/Infrastructure/Http/DefaultResponseAdapter.php):

2) Generate a signed URL (inline or download)

Links carry data (base64 JSON) + signature (HMAC). Pass expiration_minutes => null for non-expiring links.

3) Serve the file Hit the signed URL. The package validates signature/expiry, sets headers based on action (inline/attachment), and emits Cache-Control/ETag.

Helpers & Resource

How It Works

1) Upload: FilenameSanitizer. 2) Persist: MediaItemManager persists metadata through the repository binding. 3) Sign: HmacMediaItemUrlGenerator builds payload, base64 encodes, signs with HMAC. 4) Validate: HmacPayloadValidator checks presence, signature (hash_equals), payload JSON, action, and expiry. 5) Serve: LocalFileServer streams inline/attachment, applies Cache-Control/ETag, returns 304 when ETag matches.

Security Notes

Performance

Extensibility

Translations

Testing

License

MIT


All versions of spray-media with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sarkis-sh/spray-media contains the following files

Loading the files please wait ...