Download the PHP package ozhantr/ebnf without Composer

On this page you can find all versions of the php package ozhantr/ebnf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ebnf

EBNF

Framework-agnostic PHP 8.2+ library for reading .ebnf grammar files, parsing EBNF syntax, analyzing grammar definitions, and validating input against those grammars.

What Is EBNF?

EBNF stands for Extended Backus-Naur Form.

It is a formal notation used to describe the syntax of a language or mini-language. Developers often use EBNF to define things like:

What This Library Does

This library helps you work with grammars defined in EBNF.

You can use it to:

In practice, this is useful when you want to build features such as custom query inputs, textarea validation, editor tooling, or mini-DSL parsers in PHP.

Typical Use Cases

You might use this library when you want to:

EBNF Syntax Basics

This library currently supports a practical subset of EBNF syntax:

See docs/grammar-syntax.md for a fuller syntax guide.

Features

Key Terms

Installation

Development Setup

If you want to work on the library itself:

Quick Start

Parse a grammar definition into an AST:

Regex terminals are also supported:

You can also load a .ebnf file from disk and parse it:

Example grammar files in this repository:

Validate real input against a start rule:

Analyze a grammar for semantic issues:

End-to-End Example

Imagine that you want to validate a custom search box in your application.

  1. Define the search syntax in an EBNF grammar file such as examples/grammars/task-search.ebnf.
  2. Parse that grammar into an AST.
  3. Use the runtime layer to validate real user input against a start rule.

For example, this input is valid for the search_request rule:

And this input is invalid:

The runtime validator can report that failure with line and column information, which makes it suitable for textarea validation, editor tooling, or custom query inputs.

Architecture

The library is organized into separate grammar parsing, runtime validation, analyzer, and export layers. See docs/architecture.md for the current design.

Examples Guide

For a short guide to each script in examples/, see docs/examples.md.

Running Examples

Install dependencies first if you are working from the repository source:

See examples/basic.php for the runnable example.

Additional examples:

Current Scope

Supported today:

Not yet supported:


All versions of ebnf with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ozhantr/ebnf contains the following files

Loading the files please wait ...