PHPackages                             marvinjanssen/magicmounter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. marvinjanssen/magicmounter

ActiveLibrary[File &amp; Storage](/categories/file-storage)

marvinjanssen/magicmounter
==========================

PHP stream wrapper library to magically mount local or remote filesystems.

v1.0(8y ago)1282MITPHP

Since Nov 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/MarvinJanssen/magicmounter)[ Packagist](https://packagist.org/packages/marvinjanssen/magicmounter)[ Docs](https://github.com/marvinjanssen/magicmounter)[ RSS](/packages/marvinjanssen-magicmounter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

MagicMounter
============

[](#magicmounter)

**MagicMounter**, by Marvin Janssen (), released in 2017.

**MagicMounter** can magically mount "anything". These mounts can then be universally accessed using any of PHP's file/stream functions via the `magic://` stream wrapper. What makes MagicMounter unique is that it the underlying driver for a mount is transparent to the end-user. Thus, you may at one point mount a local directory at `magic://production`, and later mount a remote directory via FTP at the same mount point.

Because **MagicMounter** works as a stream wrapper, all the goodness that comes with streams is available. Think of all the stream functions, filters, iterators, and so forth. This fact arguably makes it one of the most powerful PHP FTP clients to boot, whilst staying rather succinct.

To mount:

```
Magic::mount(string $name,string $type,array $options);
```

Where:

- `$name`: the name of the mount (as magic://name).
- `$type`: the type of mount, which defines which underlying driver to load (e.g.: `'fs'`, `'ftp'`, `'ftps'`).
- `$options`: optional driver-specific options, see the driver classes for more information.

Usage
=====

[](#usage)

Install via Composer:

`composer require marvinjanssen/magicmounter`

Download project as zip file and include:

`require 'magicmounter/src/magicmounter.php'`

Example code
------------

[](#example-code)

```
// Local filesystem:

Magic::mount('backup','fs',['directory'=>'/media/backup']);

copy('./index.php','magic://backup/index.php');

Magic::unmount('backup');

// FTP:

Magic::mount('production','ftp',
	[
	'host' => 'ftp.example.com',
	'username' => 'user',
	'password' => 'password',
	'directory' => '/var/www'
	]);

copy('./index.php','magic://production/index.php');

Magic::unmount('production');
```

Drivers
=======

[](#drivers)

**MagicMounter** currently comes with 3 drivers.

fs
--

[](#fs)

Local filesystem driver.

Options:

- `directory`: local directory to mount.

ftp
---

[](#ftp)

Standard FTP driver using built-in `ftp_*` functions. The driver implements as many file system features as the PHP FTP extension permits.

Options:

- `username`: FTP username (default `'anonymous'`).
- `password`: FTP password (default `''`).
- `port`: FTP port (default `21`).
- `directory`: Optional directory (default `'/'`).
- `timeout`: FTP connection timeout (default `90`).
- `measure_transfer`: Attempt to measure transfers (default `false`).
- `exception_on_read_error`: Throw an exception if reading fails (default `false`).

To retrieve measurements if `measure_transfer` is enabled, use:

```
$resource = fopen('magic://mount/file.ext','r');

// ...

Magic::quote($resource,'download_speed');
Magic::quote($resource,'bytes_downloaded');
```

ftps
----

[](#ftps)

Extends `ftp` but uses `ftp_ssl_connect()`.

Options are the same as `ftp`.

Extending
=========

[](#extending)

Extending MagicMounter with your own drivers is easy. Create your own class in the `MagicMounter\driver` namespace and implement the `MagicMounter\Driver` interface. A good starting point is the `MagicMounter\driver\Fs` class. Having some knowledge of the PHP stream wrapper is recommended. Also, be sure that you implement as much as you can, to offer a well-rounded magic driver. (Support for `fseek()`, `fopen()`, `touch()`, `rename()`, `stat()`, `fopen()` modes, etc..)

You define any custom driver as long as it implements `MagicMounter\Driver`:

```
Magic::driver('custom','\My\CustomDriver');

Magic::mount('production','custom');
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3086d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/82701a5a61c50662a45c320234a05aec7da25c038ee3e2560c36b338e70709d0?d=identicon)[MarvinJanssen](/maintainers/MarvinJanssen)

---

Top Contributors

[![MarvinJanssen](https://avatars.githubusercontent.com/u/5727806?v=4)](https://github.com/MarvinJanssen "MarvinJanssen (4 commits)")

---

Tags

phpftpftpsfs

### Embed Badge

![Health badge](/badges/marvinjanssen-magicmounter/health.svg)

```
[![Health](https://phpackages.com/badges/marvinjanssen-magicmounter/health.svg)](https://phpackages.com/packages/marvinjanssen-magicmounter)
```

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[blueimp/jquery-file-upload

File Upload widget for jQuery.

141.5M17](/packages/blueimp-jquery-file-upload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
