Install PHP file manager using Composer

The most modern way is to add Flmngr file manager package into your PHP app using Composer and map some URL using its API.

To download and install edsdk/flmngr-server-php package, use this console command:

composer require edsdk/flmngr-server-php

Let Flmngr to handle some URL

So in the file or controller when you wish to process requests add the following call:

\EdSDK\FlmngrServer\FlmngrServer::flmngrRequest(
    array(
        // Directory of your files storage
        'dirFiles' => '/var/www/files',

        // Optionally: if you wish to use separate directory for cache files
        // This is handy when your "dirFiles" is slower a local disk,
        // for example this is a drive mounted over a network.
        //'dirCache' => '/var/www/cache'
    )
);

You can learn more about installing the package on the Flmngr for PHP module page and see example of integration on our GitHub.

Paths configuration

It is recommended to use absolute paths for all directories to avoid mistakes.

Check also the access rights for all these directories: system user used for your application or website must have both read and write right to them. For example in Ubuntu this used is called www-data, in other Linux distributions there can be other names for it i. e. apache or some custom user.

dirFiles - the place where you store all the files and images which are browsed by Flmngr file manager. You can use your existing storage you had before installation and Flmngr file manager will work like a charm with it.

dirCache and dirTmp directories can be located anywhere and do not need to be publicly accessed from the web at all. Just be sure they exist.

File Manager URL (Flmngr.urlFileManager parameter) - Set the URL on which your Flmngr backend is linked to. This depends on how you installed your backend in the previous steps. File manager client will call this URL to ask your server about something (list files, upload a file, etc.). For PHP installation in probably should contain the full URL of flmngr.php file. Please use the absolute link (with protocol and domain) to avoid mistakes.

Files URL (urlFiles client-side parameter) - Specify the prefix of URL where your files and images are available through the web. For example, if you have URL of some published image like https://example.com/images/demo.png, probably the correct Files URL will be https://example.com/images. This parameter depends on dirFiles parameter you specified on the server. The difference is server configuration explains where to store files on disk, and this client configuration explains how to access files from web.

Please see how this URL work:

Client side configuration: prefix for URLs
Files URL (urlFiles client-side parameter)
http://your-website.com/files/
/var/www/files/
Server side configuration: location of your files
dirFiles server-side parameter
+ /path/to/image.png