PHPackages                             andrea11/api-filerun - 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. andrea11/api-filerun

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

andrea11/api-filerun
====================

FileRun API Client Library

023PHP

Since Jul 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/andrea11/api-filerun)[ Packagist](https://packagist.org/packages/andrea11/api-filerun)[ RSS](/packages/andrea11-api-filerun/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

FileRun API Client PHP Library
==============================

[](#filerun-api-client-php-library)

This library is an example on how to use the [FileRun](http://www.filerun.com) API from your own PHP application. It uses the OAuth2 "resource owner credentials flow", where the credentials of the user are stored in your application.

For more information, please read the FileRun API [documentation](http://docs.filerun.com/index.php/API).

### Installation

[](#installation)

```
composer require filerun/api-client:dev-master
```

### Usage

[](#usage)

```
$FileRun = new FileRun\API\Client(array(
	'url' => 'http://WWW.YOUR-SITE.COM/FILERUN',
	'client_id' => 'GET-THIS-FROM-THE-FILERUN-CONTROL-PANEL',
	'client_secret' => 'GET-THIS-FROM-THE-FILERUN-CONTROL-PANEL',
	'username' => 'admin', //the FileRun username
	'password' => 'admin', //the FileRun password
	'scope' => ['profile', 'list', 'upload', 'download', 'weblink', 'delete', 'share'] //list of "permissions" needed to complete the operations
));
$rs = $FileRun->connect();
if (!$rs) {exit('Failed to connect');}
$FileRun->debug = true;//set this to troubleshoot possible errors
```

This will authenticate your program and allow you to call the API:

#### Getting user info

[](#getting-user-info)

```
$userInfo = $FileRun->getUserInfo();
if (!$userInfo) {
	exit('Failed to get user info: '.$FileRun->getError());
}
echo 'Hello '.$userInfo['name'].'!';
```

#### Uploading a file

[](#uploading-a-file)

```
$data = 'This is the file contents. This is some unique data: '.time().'-'.rand();
$rs = $FileRun->uploadFile(['path' => '/ROOT/HOME/MyUploadedFile.txt'], $data);
if ($rs && $rs['success']) {
	echo 'File successfully uploaded with the following contents:';
	echo ''.$data.'';
} else {
	exit('Failed to upload file: '.$FileRun->getError());
}
```

#### List folder contents

[](#list-folder-contents)

```
$rs = $FileRun->getFileList(['path' => '/ROOT/HOME']);
if ($rs && $rs['success']) {
	echo 'Here is the list of files and folders inside your home folder:';
	echo '';
	print_r($rs);
	echo '';
} else {
	exit('Failed to retrieve list of files: '.$FileRun->getError());
}
```

#### Search for files

[](#search-for-files)

```
$rs = $FileRun->searchFiles(['path' => '/ROOT/HOME', 'keyword' => 'MyUploaded']);
if ($rs && $rs['success']) {
	echo 'Search results for keyword "MyUploaded":';
	echo '';
	print_r($rs);
	echo '';
} else {
	exit('Failed to retrieve search result: '.$FileRun->getError());
}
```

#### Download a file

[](#download-a-file)

```
$rs = $FileRun->downloadFile(['path' => '/ROOT/HOME/MyUploadedFile.txt']);
if ($rs) {
	echo 'File successfully downloaded with the following contents:';
	echo ''.$rs.'';
} else {
	exit('Failed to download file: '.$FileRun->getError());
}
```

#### Create a weblink

[](#create-a-weblink)

```
$rs = $FileRun->getWebLink(['path' => '/ROOT/HOME/MyUploadedFile.txt']);
if ($rs && $rs['success']) {
	echo 'WebLink generated: '.$rs['data']['linkInfo']['url'].'';
	echo '';
} else {
	exit('Failed to get weblink: '.$FileRun->getError());
}
```

#### Sharing a folder

[](#sharing-a-folder)

```
$rs = $FileRun->shareFolder([
	'path' => '/ROOT/HOME/MyFolder',
	'uid' => 123, //share with user ID 123
	//'gid' => 456, //share with group ID 456
	'anonymous' => 0,   //set to 1 for anonymous share
	'upload' => 1,      //set to 0 to disable uploads
	'download' => 1,    //set to 0 to disable downloads
	'comment' => 1,     //set to 0 to prevent users from posting comments
	'read_comments' => 1, //set to 0 to prevent users from reading comments
	'alter' => 0,       //set to 1 to allow users to rename/delete/move/etc files
	'share' => 0,       //set to 1 to allow users to create web links inside the share
	'alias' => 'My share' //If you want the folder to be shared with a different name
]);
if ($rs && $rs['success']) {
	echo 'Folder successfully shared.';
} else {
	exit('Failed to share folder: '.$FileRun->getError());
}
```

#### Unsharing a folder

[](#unsharing-a-folder)

```
$rs = $FileRun->unShareFolder([
	'path' => '/ROOT/HOME/MyFolder',
	'uid' => 123, //unshare with user ID 123
	//'gid' => 456, //unshare with group ID 456
]);
if ($rs && $rs['success']) {
	echo 'Folder successfully unshared.';
} else {
	exit('Failed to unshare folder: '.$FileRun->getError());
}
```

#### Delete a file

[](#delete-a-file)

```
$rs = $FileRun->deleteFile(['path' => '/ROOT/HOME/MyUploadedFile.txt']);
if ($rs && $rs['success']) {
	echo 'File successfully moved to trash.';
} else {
	exit('Failed to move file to trash: '.$FileRun->getError());
}
```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/235732290?v=4)[andrea11](/maintainers/andrea11)[@andrea11](https://github.com/andrea11)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/andrea11-api-filerun/health.svg)

```
[![Health](https://phpackages.com/badges/andrea11-api-filerun/health.svg)](https://phpackages.com/packages/andrea11-api-filerun)
```

###  Alternatives

[qcloud/cos-sdk-v5

PHP SDK for QCloud COS

1931.6M155](/packages/qcloud-cos-sdk-v5)[wikimedia/relpath

Work with file paths to join or find the relative path

11948.9k4](/packages/wikimedia-relpath)

PHPackages © 2026

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