kislayphp/core
Composer 安装命令:
pie install kislayphp/core
包简介
High-performance C++ PHP extension providing HTTP/HTTPS server with routing and middleware for PHP microservices
关键字:
README 文档
README
Kislay Core is the HTTP runtime for the KislayPHP ecosystem. It provides the embedded HTTP/HTTPS server, strict segment router, request/response lifecycle, middleware, async bridge, and Promise primitives used by the higher-level modules.
Install
Prerequisites for PIE/source builds:
- macOS (Homebrew):
brew install libuv - Debian/Ubuntu: install the development packages for
libuv,curl, and OpenSSL
Ubuntu 24.04 reference flow used for the release verification:
sudo apt-get update sudo apt-get install -y pkg-config libcurl4-openssl-dev libssl-dev libuv1-dev
pie install kislayphp/core:0.0.10
Automation note:
- in a non-interactive automation session on macOS, PIE may stop after the build step because the final copy still goes through
sudo - the built module can still be validated directly from the PIE working directory before the final interactive install step
extension=kislayphp_extension.so
Build from source:
git clone https://github.com/KislayPHP/core.git
cd core
phpize
./configure --enable-kislayphp_extension
make -j4
sudo make install
Runtime contract
- Routes support only static segments and
:paramsegments. - Regex-style routes and wildcard route fragments are rejected at registration time.
- Middleware uses
function ($req, $res)and must return a truthy value to continue. - Query/body parsing is lazy.
listenAsync()requires ZTS. On NTS, runlisten()in its own process.AsyncHttpself-requests are rejected in single PHP runtime mode to avoid deadlocks.
Quick start
<?php $app = new Kislay\Core\App(); $app->setOption('log', false); $app->setOption('request_id', false); $app->setOption('trace', false); $app->use('/api', function ($req, $res) { $res->set('X-Powered-By', 'Kislay'); return true; }); $app->get('/api/users/:id', function ($req, $res) { $res->json([ 'id' => $req->param('id'), 'search' => $req->query('q', ''), ], 200); }); $app->post('/api/users/:id', function ($req, $res) { $res->json([ 'id' => $req->param('id'), 'email' => $req->input('email'), ], 200); }); $app->listen('0.0.0.0', 8080);
Request API
$req->param('id'); $req->query('name'); $req->input('email'); $req->getJson(); $req->header('authorization');
Async primitives
$app->setOption('async', true); $app->setOption('async_threads', 4); async(function () { return heavy_computation(); })->then(function ($result) { echo $result; }); $http = new Kislay\Core\AsyncHttp(); $http->get('https://api.example.com/data'); $http->retry(2, 200); $http->executeAsync()->then(function () use ($http) { echo $http->getResponseCode(); });
Performance notes
Validated locally for 0.0.10 on the current NTS reference machine with tracing, request-id generation, and request logging disabled:
/plaintext:23789.89 req/s(ab -n 100000 -c 100)/users/:id:18915.87 req/s(ab -n 40000 -c 100)/submit/:id:12974.19 req/s(ab -n 20000 -c 50)- RSS remained flat across the sustained
/plaintextstress run.
Native C++-only paths remain faster than PHP-routed paths. If you need materially higher PHP-route throughput than this NTS single-lane model provides, the next step is ZTS multi-runtime scaling rather than loosening Zend safety.
Production notes
- Use
Discoveryfor service resolution. - Use
Gatewayfor edge routing and rate limiting. - Use
Persistencefor request-scoped transaction/runtime cleanup. - Keep
request_id,trace, andlogoff in benchmark profiles unless you are measuring those features specifically.
Tests
php run-tests.php
Current local release-candidate result for 0.0.10:
15 passed2 skipped(ZTS-only async coverage)0 failed
Clean Docker verification on PHP 8.5 RC also passed before release:
NTS /plaintext:11157.65 req/s,0 failed,p95 30 msNTS /json:20085.16 req/s,0 failed,p95 9 msZTS /plaintext:16697.28 req/s,0 failed,p95 13 msZTS /json:25055.87 req/s,0 failed,p95 6 ms
Support
- Docs: https://skelves.com/kislayphp/docs/core
- Release matrix: https://skelves.com/kislayphp/docs/release-matrix
- Issues: https://github.com/KislayPHP/core/issues
kislayphp/core 适用场景与选型建议
kislayphp/core 是一款 基于 C++ 开发的 Composer 扩展包,目前已累计 72 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「http-server」 「PHP-API」 「microservices」 「high-performance」 「php-routing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kislayphp/core 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kislayphp/core 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kislayphp/core 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Rewritten FileMaker PHP-API
Single file PHP script that adds a REST API to a SQL database.
A fluent PHP library for creating API SDKs with PSR-18, PSR-17, PSR-6 and PSR-3 support
Flexible HTTP mocking application for testing and fast prototyping
Symfony Swoole Bundle
The most comprehensive PHP SDK for Canvas LMS API. Production-ready with 45 APIs implemented, rate limiting, and full test coverage.
统计信息
- 总下载量: 72
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 35
- 依赖项目数: 1
- 推荐数: 7
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-02-15