You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Query PHP arrays, CSV files, and JSON files using SQL via SQLite. Similar to Laravel's Sushi package, but framework-agnostic and works with the DAL class pattern.
Features
Query arrays with SQL - Use full SQL power on PHP arrays
CSV file support - Load CSV files as queryable tables
JSON file support - Load JSON files with nested data path support
Optional caching - Cache to SQLite files or use pure in-memory tables
Auto cache invalidation - Automatically rebuilds cache when source files change
Schema inference - Auto-detects column types or use custom schema definitions
DAL compatible - Uses the same r() and w() interface as DAL class
JOIN support - Join across multiple array/CSV/JSON tables
Current Status
Side/hobby project, not intended for serious use.
If you want something professionally maintained for Laravel projects, use Sushi.
$dal->fromArray('users', [
['id' => 1, 'name' => 'Alice', 'role_id' => 'admin'],
['id' => 2, 'name' => 'Bob', 'role_id' => 'user'],
]);
$dal->fromArray('roles', [
['id' => 'admin', 'label' => 'Administrator'],
['id' => 'user', 'label' => 'User'],
]);
$result = $dal->r(" SELECT u.name, r.label as role FROM users u JOIN roles r ON u.role_id = r.id");
Caching Behavior
// With caching enabled (default)$dal = newphpsqlarrays('/path/to/cache', true);
// Tables are cached to /path/to/cache/array_dal_cache.sqlite// Cache is automatically invalidated when source files change$dal->fromCSV('data', '/path/to/data.csv');
// Without caching (pure in-memory)$dal = newphpsqlarrays(null, false);
// Tables exist only for the lifetime of the script