DEV Community

Andreas Nicolaou
Andreas Nicolaou

Posted on • Edited on

Looking for a client-side expression language compatible with Symfony Expression Language?

A TypeScript implementation of the popular Symfony Expression Language! This library allows you to evaluate complex expressions client-side, fully mirroring the functionality of the PHP version.

Use it to create dynamic and flexible expression-based logic on the frontend while keeping it in sync with your Symfony/PHP backend.

Features

  • Full Symfony Compatibility — Works just like Symfony’s Expression Language.
  • Rich Syntax — Supports numbers, strings, operators, functions, and object/array access.
  • Custom Functions — Extend functionality by registering your own functions.
  • TypeScript Support — Fully typed, making it seamless to use in TS projects.
  • Client-Side Execution — Evaluate expressions directly in the browser.

Installation

npm install @andreasnicolaou/typescript-expression-language
Enter fullscreen mode Exit fullscreen mode

For full usage details and API documentation, visit the official npm page:

@andreasnicolaou/typescript-expression-language - npm

TypeScript implementation of symfony/expression-language. Latest version: 1.3.0, last published: 11 days ago. Start using @andreasnicolaou/typescript-expression-language in your project by running `npm i @andreasnicolaou/typescript-expression-language`. There are no other projects in the npm registry using @andreasnicolaou/typescript-expression-language.

favicon npmjs.com

Demo

Why Use This Library?

  • Eliminate Duplicate Logic — Write expressions once and use them both client-side and server-side.
  • Consistent Behavior — Ensure frontend and backend calculations match perfectly.
  • Lightweight & Fast — Optimized for speed, with minimal dependencies.
  • Safe (no eval, uses AST)
  • You can add custom functions & operators
  • Great for UI features, use in feature flags, search filters, validation rules, dashboards, etc
  • Dynamic rules without code changes, let users/admins define filters, formulas, or conditions in text.

Get Started Today!
This library is open-source and actively maintained! If you find it useful, consider giving it a ⭐️ on GitHub: expression-language

Install via npm at: expression-language

Top comments (0)