Releases: carthage-software/cel-php
Releases · carthage-software/cel-php
CEL-PHP 1.1.0
What's Changed
- chore(deps): bump infection/infection from 0.31.8 to 0.31.9 by @dependabot[bot] in #20
- chore(deps): bump azjezz/psl from 4.1.0 to 4.2.0 by @dependabot[bot] in #22
- chore(deps): bump phpbench/phpbench from 1.4.2 to 1.4.3 by @dependabot[bot] in #24
- chore(deps): bump php-coveralls/php-coveralls from 2.8.0 to 2.9.0 by @dependabot[bot] in #23
- chore(deps): bump phpunit/phpunit from 12.4.1 to 12.4.2 by @dependabot[bot] in #21
- Add string in map binary operator to core extension by @veewee in #25
New Contributors
Full Changelog: 1.0.0...1.1.0
CEL-PHP 1.0.0
What's Changed
- chore(deps): bump phpbench/phpbench from 1.4.1 to 1.4.2 by @dependabot[bot] in #19
- chore(deps): bump infection/infection from 0.31.7 to 0.31.8 by @dependabot[bot] in #18
- chore(deps): bump azjezz/psl from 4.0.1 to 4.1.0 by @dependabot[bot] in #17
Full Changelog: 1.0.0-rc.2...1.0.0
CEL-PHP 1.0.0-rc.2
fix: take context into account when caching expressions at runtime Signed-off-by: azjezz <azjezz@protonmail.com>
CEL-PHP 1.0.0-rc.1
CEL-PHP 1.0.0-rc.1 is a complete, spec-compliant implementation of the Common Expression Language specification, ready for production use.
✨ Complete Language Implementation
Core Language Features
- ✅ All Primitive Types:
int,uint,double,bool,string,bytes,null - ✅ Complex Types:
list,map,duration,timestamp - ✅ All Operators: Arithmetic (
+,-,*,/,%), Comparison (<,<=,>,>=,==,!=), Logical (&&,||,!), Membership (in) - ✅ Conditional Expressions: Ternary operator (
condition ? true_expr : false_expr) - ✅ Field Selection:
object.field,map['key'],list[0] - ✅ Message Construction:
Type{field: value}
String & Bytes Literals (NEW in RC1)
- ✅ Complete Escape Sequence Support:
- Punctuation:
\\,\?,\",\',\` - Whitespace:
\a,\b,\f,\n,\r,\t,\v - Hex escapes:
\xHH(Unicode in strings, raw bytes in bytes literals) - Unicode escapes:
\uHHHH,\UHHHHHHHH - Octal escapes:
\OOO(Unicode in strings, raw bytes in bytes literals)
- Punctuation:
- ✅ Raw Strings:
r"no \n escaping",r'...' - ✅ Triple-Quoted Strings:
"""multi-line""",'''multi-line''' - ✅ Bytes Literals:
b"...",b'...',br"...",rb"..."
Macros (All 6 Standard Macros)
- ✅
has(e.f)- Field presence checking - ✅
e.all(x, p)- Universal quantification (for-all) - ✅
e.exists(x, p)- Existential quantification (exists) - ✅
e.exists_one(x, p)- Unique existence - ✅
e.map(x, t)- List/map transformation - ✅
e.filter(x, p)- List/map filtering
📚 Standard Library (50+ Functions)
Core Extension
- Type conversions:
int(),uint(),double(),float(),string(),bytes(),bool() - Utilities:
type(),size()
String Extension (15 functions)
contains(),startsWith(),endsWith()indexOf(),lastIndexOf()split(),join(),replace()trim(),trimLeft(),trimRight()toLowerCase(),toUpperCase(),toAsciiLower(),toAsciiUpper()
List Extension (6 functions)
chunk(),flatten(),reverse(),sort(),join(),contains()
Math Extension (10 functions)
min(),max(),sum(),mean(),median()clamp(),baseConvert(),fromBase(),toBase()
DateTime Extension (13 functions)
timestamp(),duration(),now()- Accessors:
getFullYear(),getMonth(),getDayOfMonth(),getDayOfWeek(),getDayOfYear() - Time:
getHours(),getMinutes(),getSeconds(),getMilliseconds()
Decimal Extension (Optional)
- Arbitrary precision decimal arithmetic (requires
ext-decimal)
🚀 Performance & Optimization
- ✅ Expression Optimization: 6 optimization passes
- Constant folding
- Short-circuit boolean evaluation
- Identity operation removal
- Double negation elimination
- Conditional simplification
- Parentheses unwrapping
- ✅ Caching Support: PSR-16 compatible parse and evaluation caching
- ✅ Performance: Complex expressions evaluate in less than ~0.001s
🔧 Developer Experience
Simple API
use Cel;
// One-liner for simple cases
$result = Cel\evaluate('user.age >= 18', ['user' => $user]);Full-Featured API
$cel = new Cel\CommonExpressionLanguage::default();
$expression = $cel->parseString('...');
$receipt = $cel->run($optimized, $context);Caching
use Cel;
$cel = Cel\CommonExpressionLanguage::cached($cache, ttl: 3600);Extensibility
- ✅ Custom functions via
FunctionInterface - ✅ Custom binary operators via
BinaryOperatorOverloadInterface - ✅ Custom unary operators via
UnaryOperatorOverloadInterface - ✅ Custom types via
ValueResolverInterface - ✅ Clean extension system via
ExtensionInterface
📦 Installation
Install via Composer
composer require carthage-software/cel-php:1.0.0-rc.1🐛 Known Issues
None at this time. This RC is considered feature-complete and stable.
🚀 Roadmap to 1.0.0 Final
- RC1 Feedback Period (Current) - Gather community feedback
- Address Critical Issues - Fix any bugs discovered during RC
- Final Documentation Review - Ensure all docs are accurate
- 1.0.0 Release - Stable release for production use
Post-1.0.0 (Optional Enhancements)
These are not required for 1.0.0 but could be added in future versions:
- Compile-time type checking (for catching errors before runtime)
- Stack-based interpreter (for improved performance)
- Native Protocol Buffer integration
- Official CEL conformance test suite integration
💬 How to Provide Feedback
We welcome your feedback! Here's how to get in touch:
- Report Issues: GitHub Issues
- Ask Questions: GitHub Discussions
When reporting issues, please include:
- CEL-PHP version (1.0.0-rc.1)
- PHP version
- Minimal reproduction case
- Expected vs actual behavior
🙏 Acknowledgments
This project was developed by Carthage Software and is fully funded by Buhta.