PHPackages                             alphasnow/aliyun-oss-appserver - 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. alphasnow/aliyun-oss-appserver

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

alphasnow/aliyun-oss-appserver
==============================

upload data to OSS through web applications

1.1.0(2y ago)139.5k↓33.3%2MITPHPPHP ^7.2.5|^8.0

Since Mar 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/alphasnow/aliyun-oss-appserver)[ Packagist](https://packagist.org/packages/alphasnow/aliyun-oss-appserver)[ Docs](https://alphasnow.github.io/aliyun-oss-appserver/)[ RSS](/packages/alphasnow-aliyun-oss-appserver/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (8)Used By (0)

English | [简体中文](README-CN.md)

AliYun OSS AppServer
====================

[](#aliyun-oss-appserver)

[![aliyun-oss-appserver](https://camo.githubusercontent.com/7222bfeef67d58dd7c6da6075234ef95b6089f51719f2670f225165f282023f4/68747470733a2f2f736f6369616c6966792e6769742e63692f616c706861736e6f772f616c6979756e2d6f73732d6170707365727665722f696d6167653f6465736372697074696f6e3d31266c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d506c7573267468656d653d4175746f)](https://camo.githubusercontent.com/7222bfeef67d58dd7c6da6075234ef95b6089f51719f2670f225165f282023f4/68747470733a2f2f736f6369616c6966792e6769742e63692f616c706861736e6f772f616c6979756e2d6f73732d6170707365727665722f696d6167653f6465736372697074696f6e3d31266c616e67756167653d31266e616d653d31266f776e65723d31267061747465726e3d506c7573267468656d653d4175746f)

Upload data to OSS through Web applications. Add signatures on the server, configure upload callback, and directly transfer data.

[![Latest Stable Version](https://camo.githubusercontent.com/c35e5a9b6e1a2df670364adda2740c25e943d623f4e314b1b782f3acfaefee3b/68747470733a2f2f706f7365722e707567782e6f72672f616c706861736e6f772f616c6979756e2d6f73732d6170707365727665722f762f737461626c65)](https://packagist.org/packages/alphasnow/aliyun-oss-appserver)[![Total Downloads](https://camo.githubusercontent.com/c2b5f23323528074126001266465f90ef80d07a6cafabc90e370352fe92194ee/68747470733a2f2f706f7365722e707567782e6f72672f616c706861736e6f772f616c6979756e2d6f73732d6170707365727665722f646f776e6c6f616473)](https://packagist.org/packages/alphasnow/aliyun-oss-appserver)[![License](https://camo.githubusercontent.com/0f8ab8cf46535e33c809ad991686718922eda113c96cf075360b4d51927a631d/68747470733a2f2f706f7365722e707567782e6f72672f616c706861736e6f772f616c6979756e2d6f73732d6170707365727665722f6c6963656e7365)](https://packagist.org/packages/alphasnow/aliyun-oss-appserver)[![Tests](https://github.com/alphasnow/aliyun-oss-appserver/actions/workflows/tests.yml/badge.svg?branch=1.x)](https://github.com/alphasnow/aliyun-oss-appserver/actions/workflows/tests.yml)

Installation
------------

[](#installation)

```
composer require alphasnow/aliyun-oss-appserver
```

Configuration
-------------

[](#configuration)

Modify the environment file `.env`

```
OSS_ACCESS_KEY_ID=
OSS_ACCESS_KEY_SECRET=
OSS_BUCKET=
OSS_ENDPOINT=
OSS_SSL=
OSS_DOMAIN=
OSS_CALLBACK_URL=
OSS_POLICY_MAX_SIZE=
OSS_POLICY_EXPIRE_TIME=
OSS_POLICY_USER_DIR=
```

(Optional) Modify the config file `config/oss-appserver.php`

```
php artisan vendor:publish --provider=AlphaSnow\OSS\AppServer\Laravel\ServiceProvider
```

Usage
-----

[](#usage)

### OSS configuration

[](#oss-configuration)

- CORS configuration / Create rule / Example: `Soucre: *, Allow Methods: POST`

### Laravel server

[](#laravel-server)

Add route `routes/api.php`, Use the default controller.

```
Route::get("app-server/oss-token", "\AlphaSnow\OSS\AppServer\Laravel\ServerController@token");
Route::post("app-server/oss-callback", "\AlphaSnow\OSS\AppServer\Laravel\ServerController@callback");
```

### Web client

[](#web-client)

1. Download
2. Find line 30 of `upload.js` and change it to the actual server address, example: `http://laravel.local````
    // serverUrl = "http://88.88.88.88:8888"
    serverUrl = "http://laravel.local/api/app-server/oss-token"
    ```

Examples
--------

[](#examples)

### Use js client to upload file

[](#use-js-client-to-upload-file)

[Example of single-file services with clients](examples)

### Use curl to upload file

[](#use-curl-to-upload-file)

1. Get the token ```
    {
        "accessid": "access_key_id",
        "host": "https://bucket.endpoint.com",
        "policy": "eyJleHBpcmF0aW9uIjoiMjAyMi0wMy0yMVQwODoyNzoxNi4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJ1cGxvYWRcLyJdXX0=",
        "signature": "P2qcKX8/CKiCzEiDh6CE02HoTRk=",
        "expire": 1647851236,
        "callback": "eyJjYWxsYmFja1VybCI6Imh0dHA6XC9cL2RvbWFpbi5jb21cL2NhbGxiYWNrIiwiY2FsbGJhY2tCb2R5IjoiZmlsZW5hbWU9JHtvYmplY3R9JnNpemU9JHtzaXplfSZtaW1lVHlwZT0ke21pbWVUeXBlfSZoZWlnaHQ9JHtpbWFnZUluZm8uaGVpZ2h0fSZ3aWR0aD0ke2ltYWdlSW5mby53aWR0aH0iLCJjYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb25cL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCJ9",
        "dir": "upload/"
    }
    ```
2. Upload file ```
    curl --location "https://bucket.endpoint.com" \
    --form 'key="upload/${filename}"' \
    --form 'policy="eyJleHBpcmF0aW9uIjoiMjAyMi0wMy0yMVQwODoyNzoxNi4wMDBaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJ1cGxvYWRcLyJdXX0="' \
    --form 'OSSAccessKeyId="access_key_id"' \
    --form 'success_action_status="200"' \
    --form 'callback="eyJjYWxsYmFja1VybCI6Imh0dHA6XC9cL2RvbWFpbi5jb21cL2NhbGxiYWNrIiwiY2FsbGJhY2tCb2R5IjoiZmlsZW5hbWU9JHtvYmplY3R9JnNpemU9JHtzaXplfSZtaW1lVHlwZT0ke21pbWVUeXBlfSZoZWlnaHQ9JHtpbWFnZUluZm8uaGVpZ2h0fSZ3aWR0aD0ke2ltYWdlSW5mby53aWR0aH0iLCJjYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb25cL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCJ9"' \
    --form 'signature="P2qcKX8/CKiCzEiDh6CE02HoTRk="' \
    --form 'file=@"~/Downloads/image.jpg"'
    ```

### Dynamic configuration

[](#dynamic-configuration)

```
use AlphaSnow\OSS\AppServer\Factory;

$token = (new Factory($config))->makeToken();

// Change the address of the direct transmission server
$token->access()->setOssHost("https://bucket.endpoint.com");

// Change the upload directory/timeout period to 60 seconds/maximum file limit to 500 MB
$token->policy()->setUserDir("upload/")->setExpireTime(60)->setMaxSize(500*1024*1024);

// Change the callback address/callback body/callback header
$token->callback()->setCallbackUrl("http://domain.com/oss-callback")
    ->setCallbackBody("filename=\${object}&size=\${size}&mimeType=\${mimeType}&height=\${imageInfo.height}&width=\${imageInfo.width}")
    ->setCallbackBodyType("application/x-www-form-urlencoded");
```

Ali document
------------

[](#ali-document)

>

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.9% 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

Every ~141 days

Recently: every ~228 days

Total

8

Last Release

529d ago

Major Versions

0.x-dev → 1.0.02022-08-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/90877a466dd664c9a6b4ccd2a9ccf46e54427307198fa11201976aac968f5fca?d=identicon)[alphasnow](/maintainers/alphasnow)

---

Top Contributors

[![alphasnow](https://avatars.githubusercontent.com/u/8286647?v=4)](https://github.com/alphasnow "alphasnow (62 commits)")[![tanghengzhi](https://avatars.githubusercontent.com/u/2969338?v=4)](https://github.com/tanghengzhi "tanghengzhi (1 commits)")[![telanflow](https://avatars.githubusercontent.com/u/12138384?v=4)](https://github.com/telanflow "telanflow (1 commits)")

---

Tags

aliyunaliyun-ossaliyun-oss-appserveraliyun-sdkappserverlaravel-packageosslaravelaliyunossappserver

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alphasnow-aliyun-oss-appserver/health.svg)

```
[![Health](https://phpackages.com/badges/alphasnow-aliyun-oss-appserver/health.svg)](https://phpackages.com/packages/alphasnow-aliyun-oss-appserver)
```

###  Alternatives

[jacobcyl/ali-oss-storage

aliyun oss filesystem storage for laravel 5+

523566.2k7](/packages/jacobcyl-ali-oss-storage)

PHPackages © 2026

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