sutton-signwriting/core
最新稳定版本:v1.0.1
Composer 安装命令:
composer require sutton-signwriting/core
包简介
Core utilities for Formal SignWriting (FSW/SWU): conversion, queries, and style strings.
README 文档
README
A PHP 7.3+ and PHP 8.x compliant port of the Sutton SignWriting Core for Python, focused on Formal SignWriting in ASCII (FSW), SignWriting in Unicode (SWU), FSW and SWU query languages, style strings, and conversion utilities.
Core utilities for Formal SignWriting (FSW/SWU): conversion, queries, and style strings.
Install (Composer)
composer require sutton-signwriting/core
Requirements
- PHP 7.3+
mbstringextension required for Unicode-safe operations- For running tests locally:
dom,xml, andxmlwriterextensions (or use Docker Compose)
Usage
With Composer (recommended)
<?php require __DIR__ . '/vendor/autoload.php'; use function Sgnw\Core\Convert\fsw_to_swu; use function Sgnw\Core\Fsw\fsw_parse_sign; $swu = fsw_to_swu('AS10011S10019S2e704S2e748M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475'); $sign = fsw_parse_sign('AS10011S10019S2e704S2e748M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475');
Without Composer (direct include)
<?php require __DIR__ . '/src/Functions/convert.php'; require __DIR__ . '/src/Functions/style.php'; require __DIR__ . '/src/Functions/fsw.php'; require __DIR__ . '/src/Functions/fswquery.php'; require __DIR__ . '/src/Functions/swu.php'; require __DIR__ . '/src/Functions/swuquery.php'; // Example: parse an FSW sign $sign = fsw_parse_sign('AS10011S10019S2e704S2e748M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475'); // Example: convert FSW to SWU $swu = fsw_to_swu('AS10011S10019S2e704S2e748M525x535S2e748483x510S10011501x466S2e704510x500S10019476x475'); // Example: parse an SWU sign $sign = swu_parse_sign('𝠀𝠃𝤟𝤩𝣵𝤐𝤇𝣤𝤐𝤆𝣮𝣭'); // Example: build an SWU query from a sign $query = swu_to_query($sign, 'ASL');
Documentation
- Online docs: https://www.sutton-signwriting.io/core-php
- Local generation:
composer docs(ordocker compose run --rm core-php composer docs) writes output todocs/(generated output, not committed). - Local preview: run
composer docs, thendocker compose up --build docsand open http://localhost:8090 - CI publishing: on push to
main, GitHub Actions generatesdocs/and publishes it to GitHub Pages (see.github/workflows/docs.yml).- In GitHub: Settings → Pages → Build and deployment → Source = “GitHub Actions”.
Development (Docker Compose)
This repo includes a docker-compose.yml for a reproducible PHP 7.3 environment.
Path A: action flow (up + exec)
Start the services (foreground, with build):
docker compose up --build # core-php and doc server docker compose up --build core-php # core-php without doc server
In another terminal, run actions inside the running core-php container:
docker compose exec core-php composer test # run tests docker compose exec core-php composer docs # rebuild docs
Path B: one-off actions (run --rm)
Run a command in a fresh throwaway container (good for CI-like tasks):
docker compose run --rm core-php composer test
docker compose run --rm core-php composer docs
Notes: service vs container
- A Compose service is a named definition in
docker-compose.yml(e.g.core-php,docs). - A container is a running instance created from a service definition.
docker compose upcreates/starts the service containers and keeps them running.docker compose execruns a command in an already-running service container.docker compose run --rmcreates a new one-off container for that command and deletes it when finished.- If you want to start everything together, use
docker compose up --build(no service name). - When running
docker compose upwithout-d, leave it running and use another terminal forexec.
Shut everything down:
docker compose down
Structure
Public entrypoints (Composer autoload):
src/convert.phpsrc/fsw.phpsrc/fswquery.phpsrc/regex.phpsrc/swu.phpsrc/swuquery.phpsrc/style.php
Optional global wrappers (not autoloaded):
src/Functions/*.php(explicitrequire_onceper file)
Local development (no Docker)
If you already have PHP 7.3+ available locally:
composer install
composer test
composer docs
More verbose test output
vendor/bin/phpunit --testdox
License
MIT
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-09