Download the PHP package tbtop/spatie-media-library without Composer

On this page you can find all versions of the php package tbtop/spatie-media-library. 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 spatie-media-library

tbtop/spatie-media-library

An image picker for tbtop/admin forms, backed by spatie/laravel-medialibrary. The field lists one record's media collection, uploads into it, and imports images by URL.

It is a field, not a media library. Files belong to the record they are attached to — there is no shared pool, no folders, no cross-entity browsing. For files reused between entities, use the media library that ships with tbtop/admin.

The package is two halves in one repository: the PHP field (src/) and its React client (client/). Both are required.

Requirements

Install

Both halves publish from the same tag, so they cannot drift apart.

Register the client field once, wherever your admin entrypoint registers its other fields:

Register the package for class detection, or its utilities are never generated and the field renders unstyled. Tailwind skips node_modules unless a source is declared explicitly:

The path is relative to the stylesheet.

Usage

The model needs spatie's contract and a declared collection:

Then bind the field to that record and collection:

forCollection() is the whole configuration. Endpoints are derived from the page path on the client — nothing to declare, nothing to keep in sync.

Without ->multiple() the field holds a single media id; with it, a list. MediaGalleryOptions::ids() shapes a collection for the form's record().

The record must be persisted. Spatie derives the storage path from the model key, so attaching to an unsaved model is refused with a 422 rather than writing a row whose path cannot be built.

Uploading and URL import

The field posts to {page-path}/gallery-upload/{field}, registered per panel page. The target record and collection are read off the field on the re-resolved page and never from the request, so a caller cannot redirect an upload into another model. The page's own gate applies.

URL import reuses core's guards: private ranges and non-http schemes are blocked with DNS pinning against rebinding, redirects are refused, the transfer aborts when it exceeds the size ceiling, and the mime is verified from the downloaded bytes rather than the Content-Type header. Imports run synchronously and can take as long as the configured timeout.

Configuration

Key Default Meaning
per_page 24 Rows returned per options request
conversion.format webp Re-encode format: webp, jpeg, png, or null to keep the original
conversion.quality 80 Encoder quality
accept ['image/*'] fnmatch patterns; text/html is refused regardless
url_import.enabled true Whether the URL import input is accepted

The import timeout, size ceiling and host allowlist are read from tbtop-admin.media — one setting for every ingestion path, rather than a second place to configure the same thing.

Development

client/dist is a build artifact and is not committed: npm builds it from source through prepublishOnly when publishing, so the checkout never carries one.

client/package.json is the published npm manifest and the single source of truth for the version. The PHP half has no version of its own — Packagist reads it from the git tag.

Releasing

Bump the version in client/package.json and merge that to main, then run the Release workflow from main. It publishes the client to npm, pushes the vX.Y.Z tag that Packagist turns into the PHP release, and creates a GitHub Release with notes generated from the merged pull requests.

npm is published before the tag is pushed, so a failed publish leaves no dangling tag and a re-run stays clean.


All versions of spatie-media-library with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/contracts Version ^11.0||^12.0||^13.0
spatie/laravel-medialibrary Version ^11.0
spatie/laravel-package-tools Version ^1.16
tbtop/admin Version ^0.6.1
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 tbtop/spatie-media-library contains the following files

Loading the files please wait ...