360 Secure SkillHub
360 安全技能中心

Arcane

该 Skill 面向使用 Arcane 单文件 PHP 微框架的项目开发,说明基于文件系统的路由、布局与数据传递、上下文感知辅助函数、自动资源注入及本地化用法,并提供初始化脚本与参考文档入口。

分类:开发
capachow
capachow
热度 23.91
最近更新 2026-05-11 17:47:06

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add capachow/arcane
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
arcane
description
Expert guidance for building and maintaining projects with the Arcane Microframework. Use when creating new projects, defining routes, managing context-aware helpers, automatic assets, or handling localization.

Arcane Microframework

Arcane is a tiny (12kb) single-file PHP microframework where location is logic. It uses filesystem-based routing and context-aware autoloading.

Core Functions

  • env(key, default): Environment variables.
  • path(locator, actual): Unified tool for generating URLs or absolute server paths.
  • relay(name, mixed): Yield data (or HTML via callable) from page to layout.
  • scribe(string|array, replace): Translation/localization.

Project Structure

/
├── index.php        (The framework)
├── .env             (Configuration)
├── helpers/         (Context-aware logic)
├── layouts/         (Wrappers)
├── locales/         (Translations)
├── pages/           (Filesystem routes)
├── scripts/         (Auto-injected JS)
├── styles/          (Auto-injected CSS)
└── images/          (Assets)

Workflows

1. Routing & Dynamic Segments

Files in pages/ map to URLs. For dynamic segments (e.g., /blog/my-post/), use define('ROUTES', [...]) in the closest physical file (e.g., pages/blog.php).

2. Layouts & Data

Use define('LAYOUT', 'name') in a page to wrap it in layouts/name.php. Use relay() to pass data like page titles.

3. Context-Aware Helpers

Helpers in helpers/ are automatically available as variables in pages. They cascade based on the directory structure, allowing section-specific overrides.

4. Automatic Assets

CSS/JS files in styles/ and scripts/ are auto-injected if they match the layout or page path. No manual <link> or <script> tags needed.


For detailed API references and advanced patterns, refer to DOCUMENTATION.md.