PHPackages                             fx/platform - 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. fx/platform

ActiveLibrary

fx/platform
===========

多平台管理方案

v1.1.0(6y ago)111MITPHP

Since Jun 3Pushed 6y agoCompare

[ Source](https://github.com/nfangxu/package-fx-platform)[ Packagist](https://packagist.org/packages/fx/platform)[ RSS](/packages/fx-platform/feed)WikiDiscussions master Synced 3d ago

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

多平台解决方案
=======

[](#多平台解决方案)

> 基本思路: 通过 `路由参数` 来分辨不同的平台, 通过平台的不同, 实例化不同的 `Repository` 来实现数据的不同调用; 本项目的作用是简化这个过程

命令列表
----

[](#命令列表)

- `php artisan platform:make {name}` : 创建一组 Repository
- `php artisan platform:init` : 初始化

安装说明
----

[](#安装说明)

- Composer

```
composer require fx/platform
```

- 初始化

```
php artisan platform:init
```

使用
--

[](#使用)

- 路由

```
// routes/web.php
use Fx\Platform\Facades\Platform;

// others ...

// 多平台路由组
Platform::route(function () {
	Route::get('test', 'HomeController@test');
});
```

- 绑定

```
// App\Providers\AppServiceProvider

use Fx\Platform\Facades\Platform;
use App\Repositories\Contacts\UserRepository;
use App\Repositories\Admin\UserRepository as DefaultUserRepository;

public function register()
{
	// others ...

	// UserRepository
	Platform::register(UserRepository::class, DefaultUserRepository::class);
	// Or
	// Platform::registerGroup([UserRepository::class => DefaultUserRepository::class]);
}
```

- 使用

```
// App\Http\Controllers\HomeController
use App\Repositories\Contacts\UserRepository;

public function test(UserRepository $user)
{
	// do somethings with $user
	// eg: $users = $user->get();
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

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

Every ~2 days

Total

2

Last Release

2536d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48e745eaab94e5e8f347aadc5b74046bb174895188f0507b1d46c0fa6cee6555?d=identicon)[nfangxu](/maintainers/nfangxu)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/fx-platform/health.svg)

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

PHPackages © 2026

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