back to home

KarpelesLab / goro

PHP in Go

View on GitHub
694 stars
33 forks
9 issues

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing KarpelesLab/goro in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/KarpelesLab/goro)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Goro PHP engine implemented in pure Go. Targets latest PHP (currently 8.5) compatibility. Why? PHP is a nice language but is having trouble keeping up with modern languages. This implementation makes a number of things possible: • Usage of goroutines, go channels, etc from within PHP • Better caching of compiled code by allowing sharing of compiled or live objects (classes, objects, etc) between running PHP scripts • Use Go's memory management within PHP • Ability to run functions or code sandboxed (including filesystem via ) to limit security risks • Easily call the PHP engine from Go to execute pieces of PHP code (user provided or legacy) Install Status Goro passes **6,400 of 12,110 tests** (52.8%) from the PHP 8.5.4 test suite. First 2,000 tests: **1,658/2,000 (85.2%)**. All 24 batches complete, zero OOM. PHP memory_limit enforcement (128MB default). Language Features | Feature | Status | |---------|--------| | Variables, constants, type juggling | Done | | Control flow (if/else/switch/match/for/foreach/while) | Done | | Functions, closures, arrow functions ( ) | Done | | Classes, interfaces, traits, abstract classes | Done | | Enums (PHP 8.1) | Done | | Namespaces | Done | | Exceptions (try/catch/finally/throw) | Done | | Error hierarchy (Error, TypeError, ValueError, etc) | Done | | Null coalescing ( , ) | Done | | Spaceship operator ( ) | Done | | Spread operator ( ) | Done | | Named arguments (PHP 8.0) | Done | | Match expression (PHP 8.0) | Done | | Nullsafe operator ( , PHP 8.0) | Done | | Readonly properties (PHP 8.1) | Done | | Fibers (PHP 8.1) | Done | | Union/intersection types | Partial | | Generators ( ) | Done | | First-class callables ( ) | Done | | Attributes | Parsed, partially enforced | SAPIs | SAPI | Status | |------|--------| | CLI ( ) | Working | | CGI ( ) | Working | | FPM ( ) | Working | | HTTP handler ( ) | Working | | Test runner ( ) | Working | Extensions | Extension | Functions | Status | Notes | |-----------|-----------|--------|-------| | standard | 435+ | ~70% | Core functions, arrays, strings, files, math, output buffering, streams | | ctype | 11 | 100% | Complete | | json | 5 | 100% | json_encode, json_decode, json_validate, error handling | | pcre | 11 | 90% | preg_match, preg_replace, preg_split, preg_grep, preg_filter, callbacks | | hash | 11 | 80% | hash, hash_hmac, hash_file, hash_hmac_file, hash_pbkdf2, hash_hkdf, incremental | | gmp | 45+ | 55% | Arithmetic, division, modular, bitwise, primes, GCD/LCM, factorial, operator overloading, import/export | | mbstring | 40+ | 60% | strlen, substr, strpos, strtolower/upper, convert_encoding, convert_case, convert_variables, detect_encoding, check_encoding, str_split, str_pad, strimwidth, output_handler, encode/decode_mimeheader, encode/decode_numericentity | | date | 18+ | 35% | date, time, strtotime, mktime, strftime, getdate, checkdate, DateTime, DateInterval, DatePeriod | | bz2 | 1 | 10% | Decompression only (Go stdlib lacks bzip2 writer) | | spl | 6+ classes | 15% | Countable, OuterIterator, ArrayIterator, InfiniteIterator, SplFixedArray, SplDoublyLinkedList | | reflection | 5 classes | 15% | ReflectionClass, ReflectionMethod, ReflectionProperty, ReflectionFunction, ReflectionParameter | | pcre | | | Uses Go's (RE2 syntax, not PCRE2) | Not yet implemented | Extension | Notes | |-----------|-------| | session | | | iconv | Planned via | | curl | Planned via | | mysqli | | | openssl | Planned via packages | | xml / DOM | | | gd | | | zlib | | | Phar | | | sockets | | Architecture Process A process object is typically created once per runtime environment. It caches compiled code and holds global stream wrapper resources, persistent connections, and runtime cache. Global When a request is received or script execution is requested, a new Global context is created. It contains runtime state: global variables, declared functions, classes, constants, output buffers, and memory limits. Context Context is a local scope (e.g., within a running function). Global has a root context, and each function call creates a new context to separate variable scope. Contributing See development.md for details on writing extensions. Writing an extension: create a directory in , write functions with magic comment prefixes, run to generate bindings, and add the extension import to each SAPI's .