sobhanmohammadi / geometry
An immutable, precision-safe, extensible Geometry calculation library for PHP 7.4+, built entirely on top of the Sobhanmohammadi\CAS algebra engine. Includes 10 new shape-solving factories for Triangle, Rhombus, Parallelogram, and Trapezoid with support for ambiguous cases and multiple input combina
v1.2.0
2026-07-22 05:24 UTC
Requires
- php: >=7.4
- ext-bcmath: *
- ext-gmp: *
- sobhanmohammadi/cas: *
Requires (Dev)
- phpunit/phpunit: ^9.5
README
A precision-first PHP geometry engine powered by CAS
Build, calculate and explain geometric shapes with exact algebraic evaluation.
✨ Overview
Sobhanmohammadi\Geometry is a modern PHP geometry library designed for:
- 📏 Accurate geometric calculations
- 🧮 CAS-powered algebra evaluation
- 🎯 Configurable precision handling
- 🔄 Unit conversion
- 🧠 Step-by-step mathematical explanations
- 🧩 Extensible shape architecture
Unlike traditional geometry libraries, formulas are not manually calculated inside shapes. All algebraic operations are delegated through a dedicated CAS gateway.
🚀 Features
Supported Shapes
| Shape | Status |
|---|---|
| ◼ Square | ✅ |
| ▭ Rectangle | ✅ |
| ◇ Rhombus | ✅ |
| ▱ Parallelogram | ✅ |
| 🔺 Triangle | ✅ |
| ⏢ Trapezoid | ✅ |
| ⚪ Circle | ✅ |
🔥 Core Capabilities
Geometry
- Area calculation
- Perimeter calculation
- Radius & diameter
- Diagonals
- Heights
- Medians
- Centers:
- Centroid
- Circumcenter
- Orthocenter
- Incenter
Algebra Engine
- Exact expression evaluation
- Linear equation solving
- Symbolic explanations
- Numeric explanations
- Precision-aware calculations