Files
LittleBeast/README-JP.md
2025-11-08 01:34:26 +09:00

6.1 KiB
Raw Blame History

Little Beast

シンプル、実践的、アンチ・ブロート

GitHub repo size lines count

Little Beast とは?

Little Beast は PHP 8.3 以上向けのフレームワークで、076.moeゲーム開発会社と technicalsuwako.moe社長のブログ向けに作られました。
メイン考え方は「必要な物だけ拡張し、不要な物は削除する」です。
各コア機能はライブラリに分割されている為、必要な物だけを選び易い設計になっています。
全てのモジュールはゼロから書かれており、データベースは一切必要ありません。

Little Beast はテクニカル諏訪子がゲーム開発に完全復帰する前の最後の Web プロジェクトです。

Little Beast が「ではない」物

  • 汎用フレームワーク
  • 使い憎い
  • Web 開発者向け
  • 万人向け
  • インストールが面倒
  • 教条的
  • 民主的に運営される

Little Beast が「持っていない」物

  • データベース(全てファイルベース)
  • 依存関係
  • パッケージマネージャー
  • Docker/Kubernetes/Vagrant/Nix 等のコンテナ
  • JavaScript
  • ブロートウェア
  • ORM
  • 認証/認可システム
  • キューやバックグラウンドジョブ
  • クラウド/サーバーレス統合
  • スキャフォールディング
  • コード生成
  • 抽象化レイヤー
  • 不要なファイル
  • DEI、行動規範、その他の差別的慣行

独自機能

  • データベース不要
  • Composer や PEAR 不要
  • サーバーオーバーヘッドゼロ
  • コンテナ不要
  • Maron テンプレートエンジン
  • カスタム Markdown
  • ActivityPub
  • 多言語対応
  • マルチブログ対応
  • 100% 綺麗で正しい HTML5 と CSS3
  • 100% 正しい PHP
  • SEO フレンドリー
  • モジュラー CSS
  • Atom フィード
  • 組み込みテストスイート

インストール方法

cd /var/www/htdocs
git clone https://github.com/TechnicalSuwako/LittleBeast.git .
mv config/config.sample.php config/config.php

HTTP サーバーを設定して /public をルートとして php-fpm で実行して下さい。
それだけです!

OpenBSD サーバー

pkg_add php-8.4.14 php-gmp-8.4.14
rcctl enable php84_fpm httpd relayd
rcctl start php84_fpm httpd relayd

httpd

server "technicalsuwako.moe" {
  listen on * tls port 8443
  gzip-static
  tls {
    certificate "/etc/ssl/technicalsuwako.moe.crt"
    key "/etc/ssl/private/technicalsuwako.moe.key"
  }
  root "/htdocs/technicalsuwako.moe/www/public"
  directory index "index.php"
  location "/.well-known/acme-challenge/*" {
    root "/acme"
    request strip 2
  }

  location "/*.php" {
    fastcgi socket "/run/php-fpm.sock"
  }

  location "/*.php[/?]*" {
    fastcgi socket "/run/php-fpm.sock"
  }

  location "/" {
    directory index "index.php"
  }
  location match "/blog/" {
    request rewrite "/index.php"
  }
  location match "/about" {
    request rewrite "/index.php"
  }
  location match "/monero" {
    request rewrite "/index.php"
  }
  location match "/secret" {
    request rewrite "/index.php"
  }
  location match "/ap/" {
    request rewrite "/index.php"
  }
  location "/.well-known/webfinger" {
    request rewrite "/index.php"
  }
  location "/blog.atom" {
    request rewrite "/index.php"
  }
}

server "www.technicalsuwako.moe" {
  listen on * tls port 8443
  gzip-static
  tls {
    certificate "/etc/ssl/technicalsuwako.moe.crt"
    key "/etc/ssl/private/technicalsuwako.moe.key"
  }
  block return 301 "https://technicalsuwako.moe$REQUEST_URI"
}

relayd

relayd_addr="0.0.0.0"
router_addr="192.168.10.106"

table <httpd> { $router_addr }

http protocol reverse {
  tcp { nodelay, sack, socket buffer 65536, backlog 100 }
  tls ciphers "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256"
  tls keypair "technicalsuwako.moe"

  return error

  match request header append "X-Forwarded-For" value "$REMOTE_ADDR"
  match request header append "X-Forwarded-Port" value "$REMOTE_PORT"

  #match response header set "Referrer-Policy" value "same-origin"
  match response header set "X-Frame-Options" value "deny"
  match response header set "X-Content-Type-Options" value "nosniff"
  match response header set "Referrer-Policy" value "strict-origin-when-cross-origin"
  match response header set "Strict-Transport-Security" value "max-age=31536000; includeSubDomains; preload"
  match response header set "Cross-Origin-Opener-Policy" value "same-origin"
  match response header set "Content-Security-Policy" value "img-src 'self' https://*.076.moe http://*.076.moe https://*.technicalsuwako.moe http://*.technicalsuwako.moe; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; object-src 'none';"
  match response header append "Permissions-Policy" value "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=()"

  match request header "Accept-Encoding" value "gzip" tag "gzip"
  match response header "Content-Type" value "text/*" tag "compress"
  match response header "Content-Type" value "text/html" tag "charset=UTF-8"
  match response header "Content-Type" value "application/javascript" tag "compress"
  match response header "Content-Type" value "application/json" tag "compress"

  pass request quick header "Host" value "technicalsuwako.moe" forward to <httpd>

  pass
}

relay www_tls {
  listen on $relayd_addr port 443 tls
  protocol reverse

  # Default
  forward to <httpd> port 8443 check tcp
}

relay www_www {
  listen on $relayd_addr port 80
  protocol reverse

  # Default
  forward to <httpd> port 8080 check tcp
}

必要な PHP モジュール

  • php_gmp