Skip to content

Instantly share code, notes, and snippets.

@masakielastic
masakielastic / README.md
Last active February 27, 2026 06:22
ripht_php_sapi と で embed PHP の HTTP サーバー CLI を作成する

ripht_php_sapi と で embed PHP の HTTP サーバー CLI を作成する

コード

[package]
name = "mini_php_http"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 27, 2026 04:52
ripht-php-sapi で PHP スクリプトを実行する CLI ツールを開発する

ripht-php-sapi で PHP スクリプトを実行する CLI ツールを開発する

コード

Cargo.toml

[package]
@masakielastic
masakielastic / README.md
Last active February 27, 2026 03:10
tiny_http と ext-php-rs で embed PHP の HTTP サーバーを作成する

tiny_http と ext-php-rs で embed PHP の HTTP サーバー CLI を作成する

ソースコード

Cargo.toml

[package]
name = "php-embed-tinyhttp"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 27, 2026 02:22
tiny_http で HTTP/1 サーバーの PHP 拡張

tiny_http で HTTP/1 サーバーの PHP 拡張

コード

[package]
name = "tiny_http_php"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Created February 27, 2026 01:05
tiny_http で TLS

tiny_http で TLS

Cargo.toml

[package]
name = "tiny-http-tls-example"
version = "0.1.0"
edition = "2021"
@masakielastic
masakielastic / README.md
Last active February 27, 2026 00:48
ext-php-rs で PHP スクリプトを実行する CLI を作成する

ext-php-rs で PHP スクリプトを実行する CLI を作成する

ソースコード

Cargo.toml

[package]
@masakielastic
masakielastic / README.md
Last active February 26, 2026 21:41
ext-php-rs と embed PHP で実行したスクリプトの結果を取得する

ext-php-rs と embed PHP で実行したスクリプトの結果を取得する

src/main.rs

use ext_php_rs::builders::SapiBuilder;
use ext_php_rs::embed::{ext_php_rs_sapi_shutdown, ext_php_rs_sapi_startup, Embed};
use ext_php_rs::ffi::{
@masakielastic
masakielastic / README.md
Last active February 26, 2026 21:17
ext-php-rs と Embed PHP を利用して PHP スクリプトを実行する

ext-php-rs で Embed PHP を利用する

sudo apt install libphp-embed

Cargo.toml

[package]
@masakielastic
masakielastic / scheduler.php
Created February 25, 2026 16:02
HTTPS対応版:Fiberスケジューラ + https_get_async()
<?php
/**
* Fiber協調スケジューラ(sleep + readable + writable)
*/
final class Scheduler
{
/** @var SplQueue<array{0:Fiber,1:mixed}> */
private SplQueue $ready;
@masakielastic
masakielastic / scheduler.php
Created February 25, 2026 15:56
スケジューラーで非同期 HTTP GET
<?php
/**
* Fiber協調スケジューラ(sleep + readable + writable)
* - await(['sleep', seconds]) -> resume(seconds)
* - await(['readable', stream]) -> resume(stream)
* - await(['writable', stream]) -> resume(stream)
*/
final class Scheduler
{