$ show catfan/Medoo
Medoo is a lightweight PHP database framework that provides a fluent, array-based API for building SQL queries and mapping results. It supports multiple database engines (MySQL, PostgreSQL, SQLite, MSSQL, Oracle, Sybase) via the PDO extension. The library is contained in a single source file (src/Medoo.php) and offers CRUD operations, joins, aggregates, raw SQL, transactions, and column type mapping. It is designed to be simple and intuitive, fitting naturally into various PHP frameworks. The codebase includes a comprehensive test suite that validates SQL generation across different database dialects, and the project is actively maintained with modern PHP version support.
The LLM identified 2 files worth highlighting for reuse:
The Raw class (defined within Medoo.php) is a simple data object that encapsulates a raw SQL string and its bound parameters. It can be used independently of the Medoo class to represent arbitrary SQL fragments, making it a reusable pattern for any PHP database layer that needs to mix raw SQL with a query builder.
This test file demonstrates a reusable pattern for testing internal/private methods of a class by subclassing it and exposing those methods publicly. It shows how to validate column mapping and data mapping logic in isolation, which can be adapted to test other complex internal transformations in PHP libraries.