wiki-connect/parsewiki
最新稳定版本:2.0
Composer 安装命令:
composer require wiki-connect/parsewiki
包简介
A library that helps parse wikitext template data
README 文档
README
A powerful PHP library for parsing MediaWiki-style content from raw wiki text.
📚 Overview
This library allows you to extract:
- Templates (single, multiple, nested)
- Internal wiki links
- External links
- Citations (references)
- Categories (with or without display text) Perfect for handling wiki-formatted text in PHP projects.
🗂️ Project Structure
ParserTemplates: Parses multiple templates.ParserTemplate: Parses a single template.ParserInternalLinks: Parses internal wiki links.ParserExternalLinks: Parses external links.ParserCitations: Parses citations and references.ParserCategories: Parses categories from wiki text.DataModelclasses:AttributeCitationExternalLinkInternalLinkParametersTemplate
tests/: Contains PHPUnit test files:ParserCategoriesTestParserCitationsTestParserExternalLinksTestParserInternalLinksTestParserTemplatesTestParserTemplateTestDataModeltests:AttributeTestParametersTestTemplateTest
🚀 Features
- ✅ Parse single and multiple templates.
- ✅ Support nested templates.
- ✅ Handle named and unnamed template parameters.
- ✅ Extract internal links with or without display text.
- ✅ Extract external links with or without labels.
- ✅ Parse citations including attributes and special characters.
- ✅ Parse categories, support custom namespaces, handle whitespaces and special characters.
- ✅ Full PHPUnit test coverage.
🧩 Wikitext Features Support
| Feature | Read ✅ | Modify ✏️ | Replace 🔄 |
|---|---|---|---|
| Templates | ✅ Yes | ✅ Yes | ✅ Yes |
| Parameters | ✅ Yes | ✅ Yes | ✅ Yes |
| Citations | ✅ Yes | ✅ Yes | ✅ Yes |
| Citations>Attributes | ✅ Yes | ✅ Yes | ✅ Yes |
| Internal Links | ✅ Yes | ||
| External Links | ✅ Yes | ||
| Categories | ✅ Yes | ||
| HTML Tags | |||
| Parser Functions | |||
| Tables | |||
| Sections | |||
| Magic Words |
🟡 Note: Some features are partially supported or under development. Contributions are welcome!
⚙️ Requirements
- PHP 8.0 or higher
- PHPUnit 9 or higher
💻 Installation
composer require wiki-connect/parsewiki
Make sure you have proper PSR-4 autoloading for the WikiConnect\ParseWiki namespace.
🧪 Running Tests
vendor/bin/phpunit tests
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2023-12-03