承接 veasin/nx-tiny-franken 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

veasin/nx-tiny-franken

最新稳定版本:0.0.2

Composer 安装命令:

composer require veasin/nx-tiny-franken

包简介

FrankenPHP worker integration for nx-tiny micro-framework.

README 文档

README

FrankenPHP worker mode adapter for nx-tiny micro-framework.

Install

composer require veasin/nx-tiny-franken

Usage

<?php
// franken.php - FrankenPHP worker entry point
include __DIR__ . '/vendor/autoload.php';

use function nx\{container, franken, from, log, output, route};

container('count', 0);

franken(function () {
    log(from('uri', 'input'));

    route([
        'get:/'         => fn() => output('hello world!', 'http'),
        'get:/hi'       => fn() => output('hi~', 'http'),
        'get:/count'    => function () {
            $count = container('count') + 1;
            output("count: $count", 'http');
            container('count', $count);
        },
    ]);
}, function () {
    // cleanup on each request cycle end
});

Caddyfile

localhost {
    log
    root demo/
    php_server {
        try_files {path} franken.php
        worker {
            file ./demo/franken.php
            watch ./src/**/*.php
            watch ./demo/**/*.php
            num 4
        }
    }
}

Run with:

frankenphp run --config demo/Caddyfile

API

franken(callable $worker, ?callable $clear): void

Wraps the FrankenPHP worker loop:

  • Sets up a PSR-3 compatible logger via frankenphp_log() on first call.
  • Calls $worker() on each request. If $worker() returns a truthy value, subsequent output/cleanup is skipped.
  • Calls $clear() after each request cycle ends (if callable).

License

LGPL-3.0-or-later

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2026-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固