PHPackages                             labspace/upload-api - 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. labspace/upload-api

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

labspace/upload-api
===================

labspace package for upload-api

1.2.5(5y ago)0354MITPHPPHP ^7.0

Since Jan 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ChichiHuang/labspace-upload-api)[ Packagist](https://packagist.org/packages/labspace/upload-api)[ RSS](/packages/labspace-upload-api/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (17)Used By (0)

母專案要做的事情

STEP.0

圖片處理intevention先安裝設定好、jwt機制要ready~ cors也要準備好

============

STEP.1

安裝套件

composer require labspace/upload-api

============

STEP.2

到config/app.php 的providers加上

Labspace\\UploadApi\\UploadApiServiceProvider::class,

============

STEP.3

在app\\App\\Providers\\AppServiceProvider 的boot 裡面新增base64圖片檢查code

（記得use Validator）

Validator::extend('base64image', function ($attribute, $value, $parameters, $validator) { $explode = explode(',', $value); $allow = \['png', 'jpg', 'svg'\]; $format = str\_replace( \[ 'data:image/', ';', 'base64', \], \[ '', '', '', \], $explode\[0\] ); // check file format if (!in\_array($format, $allow)) { return false; } // check base64 format if (!preg\_match('%^\[a-zA-Z0-9/+\]\*={0,2}$%', $explode\[1\])) { return false; } return true; });

============

STEP.4

php artisan vendor:publish --tag=config

會新增專屬config檔 labspace-upload-api.php 裡面可以設定登入user model的位置

============

STEP.5

migration新增

php artisan vendor:publish --tag=migration-temp

====================

使用說明

\[上傳圖片（file） - POST\] file:檔案（必填） width:寬度(必填) type:類型 token:使用者token

http://\[server\_url\]/lab/api/upload/image/file

{ "status": true, "data": { "filepath": "/avatar/1/20200121182207182207.jpg" }, "success\_code": "SUCCESS" }

\[上傳圖片（base64） - POST\] file:base64字串（必填） width:寬度(必填) type:類型 token:使用者token extension:檔案類型

http://\[server\_url\]/lab/api/upload/image/base64

{ "status": true, "data": { "filepath": "/avatar/1/20200121182207182207.jpg" }, "success\_code": "SUCCESS" }

\[上傳影片（file） - POST\] file:檔案（必填） type:類型 token:使用者token

http://\[server\_url\]/lab/api/upload/video/file

{ "status": true, "data": { "filepath": "/avatar/1/20200121182207182207.jpg" }, "success\_code": "SUCCESS" }

====================

\[檔案管理器\]

filesystems.php 要新增檔案管理器file-upload儲存位置

'file-upload' =&gt; \[ 'driver' =&gt; 'local', 'root' =&gt;storage\_path('app/public/manager'), \],

==========

helper.php要有以下function

//刪除特殊符號 function clean\_file\_name($filename){

```
$bad = array(

"",

"'",

"",

'"',

'&',

'$',

'=',

';',
':',
'@',

'?',

'/'

);

$filename = str_replace($bad, '', $filename);

return stripslashes($filename);

```

}

/\*\*

- 取得縮圖 \*@param path 字串 \*@return string \*\*/ function get\_thumbnail($path){

    $arr = explode("/",$path);

    $filename = end($arr);

    $new\_path = ''; foreach($arr as $key=&gt; $item){ if($key == (count($arr) -1 )){ $new\_path .= 'thumbs/'.$filename; } else { $new\_path .= $item.'/'; } } return $new\_path; }

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 94.4% 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 ~24 days

Recently: every ~12 days

Total

16

Last Release

1946d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e897bf1c204380db988430f4481aba385e651e90e78bca289e54c555a206565e?d=identicon)[ChichiHuang](/maintainers/ChichiHuang)

---

Top Contributors

[![Kurapikov](https://avatars.githubusercontent.com/u/4757294?v=4)](https://github.com/Kurapikov "Kurapikov (17 commits)")[![ChichiHuang](https://avatars.githubusercontent.com/u/17561166?v=4)](https://github.com/ChichiHuang "ChichiHuang (1 commits)")

### Embed Badge

![Health badge](/badges/labspace-upload-api/health.svg)

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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