nxp/math-executor
Safely parse and evaluate math expressions from strings in PHP. nxp/math-executor is a lightweight library with variables, functions, custom operators, and caching, ideal for calculators, dynamic pricing, and formula-driven logic in Laravel and PHP apps.
TypeError, ValueError, DivisionByZeroError, or other native exceptions may silently miss failures or change fallback behavior.MathExpressionService) bound as a singleton, with a config/math.php for allowed functions, variable limits, expression length caps, precision policy, and exception-to-domain-error mapping. Do not expose it directly to Blade, controllers, or JavaScript eval. Catch the package’s MathExecutor exception base class rather than native PHP exceptions.eval, symfony/expression-language, or custom calculators, introduce an adapter interface and map syntax/function names explicitly. For v2.4.0, audit existing catch blocks and tests for reliance on native PHP exceptions, then normalize package exceptions into application-owned error types. Run old and new evaluators in shadow mode on stored formulas, compare outputs and error behavior, and migrate expressions only after validation. Keep a feature flag and rollback path until parity is proven.symfony/expression-language or an internal parser if needed.How can I help you explore Laravel packages today?