PHPackages                             next/simple - 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. [Framework](/categories/framework)
4. /
5. next/simple

ActiveProject[Framework](/categories/framework)

next/simple
===========

一款支持swoole/workerman/cli-server/FPM环境的PHP框架。

0.2.2(4mo ago)26281Apache-2.0PHPPHP ^8.2CI failing

Since Oct 31Pushed 4mo agoCompare

[ Source](https://github.com/next-laboratory/simple)[ Packagist](https://packagist.org/packages/next/simple)[ RSS](/packages/next-simple/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (10)Versions (9)Used By (0)

[![Max](https://raw.githubusercontent.com/next-laboratory/simple/master/public/favicon.ico)](https://raw.githubusercontent.com/next-laboratory/simple/master/public/favicon.ico)

轻量 • 简单 • 快速

[![](https://camo.githubusercontent.com/ed87c526abd55232810334708f1b6b6029aeacc60776f454bbe43bbfb096b04b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6e6578742d6c61626f7261746f72792f73696d706c65)](https://github.com/next-laboratory/simple/issues)[![](https://camo.githubusercontent.com/33952d0758b70d7dce334493ad1b68370be30e9efbac9998cafc63220769473d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e6578742d6c61626f7261746f72792f73696d706c65)](https://github.com/next-laboratory/simple)[![](https://camo.githubusercontent.com/57a4b2b97b530830a27833fee0e4f091c19a05a2936c2e4a1b319d1349ad1f35/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d627269676874677265656e)](https://camo.githubusercontent.com/57a4b2b97b530830a27833fee0e4f091c19a05a2936c2e4a1b319d1349ad1f35/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d627269676874677265656e)[![](https://camo.githubusercontent.com/f9238ae34e95bcfac3cc13d2cf28d63d73292aab0d475c2d56df7c7bb7b34af1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d617061636865253230322d626c7565)](https://camo.githubusercontent.com/f9238ae34e95bcfac3cc13d2cf28d63d73292aab0d475c2d56df7c7bb7b34af1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d617061636865253230322d626c7565)

一款支持swoole, workerman, FPM环境的组件化的轻量`PHP`框架

环境要求
----

[](#环境要求)

```
PHP  ^8.2

```

> 如果使用swoole，务必安装4.6以上版本，如果使用workerman, 务必使用4.0以上版本

使用
--

[](#使用)

### 安装

[](#安装)

```
composer config -g repo.packagist composer https://repo.packagist.org # 更换官方仓库
composer create-project next/simple
```

### 启动服务

[](#启动服务)

```
php bin/cli-server.php           // 内置服务
php bin/swoole.php               // swoole
php bin/workerman.php            // workerman
```

> FPM模式，将请求指向public/index.php即可

区别
--

[](#区别)

使用swoole/workerman/amp/react等服务支持注解、AOP等特性， FPM模式可以直接卸载AOP包。

简单入门
----

[](#简单入门)

### 路由定义

[](#路由定义)

> 路由定义在 `app/router.php` 文件中，也可以使用注解定义（需要安装AOP包，且不支持FPM/内置服务）

下面是在`app/router.php`中定义的路由

```
$router->middleware(new SessionMiddleware(), new VerifyCSRFToken())
   ->group(function (Router $router) {
       $router->get('/', [new IndexController(), 'index']);
       $router->get('openapi', [new IndexController(), 'opanapi']);
   });
```

当你使用swoole/swoole/workerman/amp/reactphp并且使用了AOP就可以使用注解定义

```
