Download the PHP package themusicdev/files without Composer

On this page you can find all versions of the php package themusicdev/files. 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 files

TheMusicDev/Files

Uploads and file management for CakePHP 5 sites, built once and reused: Flysystem v3 storage, one stored_files ledger row per file, dot-path collections as virtual folders, a validation and lifecycle seam (FileStore), and gated serving through a route the plugin ships. Your application never touches the filesystem and keeps only a thin *_file_id column in its own tables.

Status: stable, v1.0.0. It has run in production on one site (themusicdev.llc) and is now a standalone package. Requires PHP 8.2+ (with ext-fileinfo) and CakePHP 5.2+.

Why

Uploads recur in every site, and the naive per-module version loses the original filename, leaves orphan files behind when a write fails, and reinvents MIME validation each time. This plugin does the hard-to-get-right parts once: a module declares a collection and stores a file id. The reasoning behind each decision is in docs/decisions.md and the design of record in docs/file-management-and-uploads.md; this README is the how.

Install

Loading the plugin also mounts its one route, GET /files/serve/{id}. After the migration on an existing install, run bin/cake schema_cache clear: Cake silently drops columns its cached schema does not know when saving.

Configure

Defaults ship in the plugin's config/app_default.php and are merged under your values, so a host overrides only what it differs on. Put yours in config/app.php under Files:

Key Default Meaning
backend local Which entry of backends is active.
backends local at ROOT/data/uploads Flysystem adapters: class plus the arguments that adapter needs. The local adapter and the S3 adapter (league/flysystem-aws-s3-v3) are wired to their arguments; any other adapter needs a small change in FileStore::adapterArgs(). The local root is created on first run.
collections uploads.misc (25 MB, any type) Your collections are added beside the built-in one; redefine uploads.misc to change it.
authCallable null The serve gate. null means nothing is served (403).

S3 (and any S3-compatible object store)

The package is not shipped as a dependency — run composer require league/flysystem-aws-s3-v3 in your app first, then:

Without the flysystem-s3 package installed, selecting an S3 backend throws a FileStoreException naming the package to install (instead of a fatal error). Nothing about the ledger, collections or serve gate changes with the backend.

Opt-in integration test against a real server

The fake-client tests stay hermetic; a real round-trip (put → exists → read → purge) runs only when you ask for it, against any S3-compatible server (RustFS, MinIO, AWS, …):

Without S3_TEST_ENDPOINT the group skips itself; CI never starts a server. S3_TEST_KEY / S3_TEST_SECRET / S3_TEST_BUCKET / S3_TEST_REGION / S3_TEST_PATH_STYLE override the defaults for other endpoints.

The serve gate (Files.authCallable)

GET /files/serve/{id} calls authCallable($file) with the ledger row before it reads a byte. The plugin has no auth of its own: your callable decides, and refuses by throwing (a RedirectException to your login page, a ForbiddenException, whatever fits). Returning normally allows the download. Collections with 'public' => true skip the callable.

Two details that bite: build the login URL with 'plugin' => false (the closure runs inside the plugin's request), and re-check that the account still exists, not just that a session is present, or a deleted user keeps downloading.

Use

Host your own admin screens

The plugin ships storage, the ledger and the serving route, not admin screens: branding, auth and layout belong to the site. examples/ has a working admin file browser (controller, template, routes: list collections, paginated file list, upload, soft delete) to copy and restyle. It is not autoloaded. Whatever gate you put on those screens, put the same check in Files.authCallable.

Gotchas

Development

Tests run on MariaDB, never sqlite. Override the connection with DATABASE_TEST_URL. Conventions shared by every TheMusicDev plugin (naming, layout, CI, workflow) live in TheMusicDev/cakephp-conventions.

License

MIT, see LICENSE.


All versions of files with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-fileinfo Version *
cakephp/cakephp Version ^5.2
league/flysystem Version ^3.0
league/flysystem-local Version ^3.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 themusicdev/files contains the following files

Loading the files please wait ...