Download the PHP package abstract/core without Composer
On this page you can find all versions of the php package abstract/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download abstract/core
More information about abstract/core
Files in abstract/core
Package core
Short Description Componential language using HTML-based syntax to access PHP class and method
License proprietary
Informations about the package core
Abstract Core For PHP
This package is the PHP implementation of Abstract. It parses Abstract source into the shared canonical tree, resolves safe data-driven commands, maps the tree for a target, and emits source or rendered output.
Start with the shared documentation if Abstract is new to you:
- Core Concepts: the parser, node, resolver, mapper, and emitter pipeline.
- Source Commands: every built-in command, preferred spelling, alias, result, and constraint.
- Extending Abstract: supported custom mappers, emitters, render targets, and external formats.
- Feature Parity: PHP and TypeScript support compared.
Index
- Requirements And Installation
- Quick Start
- Source, Tree, Resolution, And Rendering
- Parsing
- Source Emission
- Rendering
- Strict And Loose Modes
- Imports
- Custom Targets
- Examples And Development
Requirements And Installation
- PHP 8.2 or later
- Composer
- PHP DOM/libxml for HTML, AML, and XML parsing
- the
pklCLI only when using Pkl parsing
From this package checkout:
The package namespace is Abstract\ and Composer package name is abstracts/abstract.
Quick Start
This is the same walkthrough used in the TypeScript guide.
Output:
The parser creates canonical nodes. renderHtml() then resolves :logic:gte, :logic:var, and :if, maps the selected branch to HTML, and emits the string.
Source, Tree, Resolution, And Rendering
Use the operation that matches the job:
sourceJson() and sourceAml() do not evaluate conditions or loops. treeJson() does not convert back to tag-key source. See Source Emission And Rendering for the conceptual difference.
Parsing
AbstractCore exposes these parser methods:
| Format | String method | File method | Notes |
|---|---|---|---|
| JSON tag-key | parseJson() |
parseJsonFile() |
reference native-data syntax |
| AML | parseAml() |
parseAmlFile() |
Abstract command tags such as <:if> and <:logic:eq> |
| HTML | parseHtml() |
parseHtmlFile() |
DOMDocument-backed markup parsing |
| XML | parseXml() |
parseXmlFile() |
XML parsing with Abstract-aware command preprocessing |
| YAML | parseYaml() |
parseYamlFile() |
normalizes through the native tag-key parser |
| TOML | parseToml() |
parseTomlFile() |
object/table-oriented source |
| Pkl | parsePkl() |
parsePklFile() |
PHP-only; trusted local modules through the pkl CLI |
Normal keys become Elements. Primitive values become inferred Values. Internal commands begin with :. Use :type:* and :logic:* for new typed and logic source:
The complete grammar is maintained in the Source Commands, not duplicated here.
Markup Options
MarkupParseOptions controls mode-specific behavior such as fragments, whitespace, comments, doctypes, source metadata, strictness, runtime tags, nonstandard names, boolean attributes, and libxml flags.
Text-only markup remains text and does not gain an implicit paragraph.
Source Emission
Readable domain-qualified commands are the default:
Symbol operator output is optional:
Primitive JSON shorthand remains the default. Request explicit :type:* wrappers when source must carry declared types:
Canonical tree output is independent of source spelling:
It contains kind: "logic", canonical op: "eq", and args.
Rendering
Built-in output operations include:
| Method | Output |
|---|---|
renderHtml() |
resolved HTML |
renderXml() |
resolved XML with explicit closing tags |
renderJsx() |
resolved JSX-like source through PHP's React mapper |
renderYaml() |
resolved tree data as YAML |
renderToml() |
resolved tree data as TOML |
renderPkl() |
resolved tree data as Pkl |
render($target, ...) |
any registered Render Target |
TOML and Pkl output require object/map roots because their document models are property-oriented. YAML supports scalar, list, and map roots.
Strict And Loose Modes
Strict mode is the default.
- Strict parsing rejects unknown explicit
:logic:*and:type:*commands. - Loose parsing records diagnostics and preserves a safe unresolved Runtime form.
- Strict resolution rejects unknown Runtime commands, misplaced contextual commands, and inert directives.
- Loose resolution records warnings and drops nodes it cannot safely resolve.
Loose mode supports editing and diagnostics. It does not execute or register unknown commands.
Imports
:import and :include resolve relative to the importing source path, then cache parsed files by path, modification time, and content hash.
Import props extend the imported resolution context. Slot children append to the imported root Element or Fragment. Missing and circular imports are errors in strict mode.
The PHP core currently owns filesystem imports directly; there is no public PHP import-loader interface.
Custom Targets
Target customization is intentionally separate from source commands. A custom HTML mapping changes output without changing the canonical tree:
For complete custom mapper/emitter examples and closed extension boundaries, use Extending Abstract.
Examples And Development
Runnable examples are in examples/, including logic, imports, AML, XML, YAML, TOML, Pkl, mappings, and large HTML round trips.
Additional PHP references:
- SPEC.md: PHP-specific formal behavior and implementation notes.
- ARCHITECTURE.md: PHP package structure and ownership.
- DEVELOPMENT.md: change and verification workflow.
- PERFORMANCE.md: benchmark method and recorded results.
- REPORT.md: historical rescue and design record.
The root Source Commands are the canonical shared documentation.