PHPackages                             reactphp-x/laravel-zero - 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. reactphp-x/laravel-zero

ActiveProject[Framework](/categories/framework)

reactphp-x/laravel-zero
=======================

The Reactphp Framework build top of Framework X and Larave zero.

28PHP

Since Oct 6Pushed 7mo agoCompare

[ Source](https://github.com/reactphp-x/laravel-zero)[ Packagist](https://packagist.org/packages/reactphp-x/laravel-zero)[ RSS](/packages/reactphp-x-laravel-zero/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

reactphp-x
==========

[](#reactphp-x)

reactphp-x基于 laravel-zero 和 reactphp 的异步web框架

install
-------

[](#install)

```
composer create-project reactphp-x/reactphp-x dev-master -vvv
```

config
------

[](#config)

cp .env.example .env

启动项目
----

[](#启动项目)

```
php artisan reactphp:http start

```

visit
-----

[](#visit)

Documentation
-------------

[](#documentation)

### Route

[](#route)

routes/api.php

```
use ReactphpX\LaravelReactphp\Facades\Route;
use React\Http\Message\Response;
use Psr\Http\Message\ServerRequestInterface;

Route::get('/', function (ServerRequestInterface $request) {
    return Response::plaintext(
        "Hello wörld!\n"
    );
});

$class = new class {
    public function index(ServerRequestInterface $request) {
        return Response::plaintext(
            "Hello wörld!\n"
        );
    }
};

Route::get('/at', get_class($class).'@index');

// Route::get('/controller', 'App\Http\Controllers\IndexController@index');

$middlware1 = function ($request, $next) {
    // todo middleware
    return $next($request);
};
$middlware2 = function ($request, $next) {
    // todo middleware
    return $next($request);
};
Route::group('/users', $middlware1, $middlware2, function () {
    Route::get('/', function (ServerRequestInterface $request) {
        return Response::plaintext(
            "Hello wörld!\n"
        );
    });
    Route::get('/{id}', function (ServerRequestInterface $request) {
        $id = $request->getAttribute('id');
        return Response::plaintext(
            "Hello wörld! $id\n"
        );
    });
});

Route::middleware($middlware1,$middlware2)->group('/users', function () {
    Route::get('/', function (ServerRequestInterface $request) {
        return Response::plaintext(
            "Hello wörld!\n"
        );
    });
    Route::get('/{id}', function (ServerRequestInterface $request) {
        $id = $request->getAttribute('id');
        return Response::plaintext(
            "Hello wörld! $id\n"
        );
    });
});
```

### Middleware

[](#middleware)

```
use App\Http\Middlewares\ExampleMiddleware;

Route::middleware(ExampleMiddleware::class)->group('/users', function () {
    Route::get('/', function (ServerRequestInterface $request) {
        return Response::plaintext(
            "Hello wörld!\n"
        );
    });
});
```

### Request Params

[](#request-params)

```
// 获取请求头
$serverParams = $request->getServerParams();
// 获取请求参数
$queryParams = $request->getQueryParams();
// Content-Type: application/x-www-form-urlencoded or Content-Type: multipart/form-data
$name = $request->getParsedBody()['name'] ?? 'World';
// Content-Type: application/json
$data = json_decode((string)$request->getBody());
```

### Controller

[](#controller)

```
use App\Http\Controllers\ExampleController;

Route::get('/example', ExampleController::class.'@index');
```

### cron

[](#cron)

routes/cron.php 默认开启，在 `config/cron.php` 设置 `enabled=false` 关闭

```
/**
 *  Finds next execution time(stamp) parsin crontab syntax.
 *
 * @param string $crontab_string :
 *   0    1    2    3    4    5
 *   *    *    *    *    *    *
 *   -    -    -    -    -    -
 *   |    |    |    |    |    |
 *   |    |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 *   |    |    |    |    +----- month (1 - 12)
 *   |    |    |    +------- day of month (1 - 31)
 *   |    |    +--------- hour (0 - 23)
 *   |    +----------- min (0 - 59)
 *   +------------- sec (0-59)
 */
new Crontab('* * * * * *', function () {
    echo 'every_second: '. date('Y-m-d H:i:s') . "\n";
});
```

### 异步ORM

[](#异步orm)

请参考 [https://github.com/reactphp-x/orm，该项目已集成](https://github.com/reactphp-x/orm%EF%BC%8C%E8%AF%A5%E9%A1%B9%E7%9B%AE%E5%B7%B2%E9%9B%86%E6%88%90)

使用之前先配置数据库

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=123456
DB_DATABASE=xxxx

```

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance44

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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/76907477?v=4)[wpjscc](/maintainers/wpjscc)[@wpjscc](https://github.com/wpjscc)

---

Top Contributors

[![wpjscc](https://avatars.githubusercontent.com/u/76907477?v=4)](https://github.com/wpjscc "wpjscc (16 commits)")

### Embed Badge

![Health badge](/badges/reactphp-x-laravel-zero/health.svg)

```
[![Health](https://phpackages.com/badges/reactphp-x-laravel-zero/health.svg)](https://phpackages.com/packages/reactphp-x-laravel-zero)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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