puneetxp / the
php dependcies for The framework
Requires
- php: >=8.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 0.1.306
- 0.1.305
- 0.1.304
- 0.1.303
- 0.1.302
- 0.1.301
- 0.1.299
- 0.1.164
- 0.1.63
- 0.1.62
- 0.1.61
- 0.1.60
- 0.1.59
- 0.1.58
- 0.1.57
- 0.1.56
- 0.1.55
- 0.1.54
- 0.1.53
- 0.1.52
- 0.1.51
- 0.1.50
- 0.1.46
- 0.1.45
- 0.1.44
- 0.1.43
- 0.1.42
- 0.1.41
- 0.1.40
- 0.1.38
- 0.1.37
- 0.1.36
- 0.1.35
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-feat/query-chain
- dev-puneetxp-patch-4
- dev-puneetxp-patch-3
- dev-puneetxp-patch-2
- dev-puneetxp-patch-1
This package is auto-updated.
Last update: 2026-11-10 06:34:45 UTC
README
Dependencies Library for the THE framework.
Database
MySQL/MariaDB (default) or PostgreSQL through PDO. Needs the pdo_mysql or
pdo_pgsql extension. Configure with constants or environment variables:
dbdriver (mysql or postgres), dbhost, dbport, dbuser, dbpwd,
dbname. Lowercase and uppercase constant names both work.
All models share one connection, opened on the first query.
Querying through models
Book_stock::where(['publish' => 1, 'enable' => 1]) ->whereHas('book', ['public_listing' => 1]) ->whereHas('product', fn ($p) => $p->where(['enable' => 1])) ->orderBy('id') ->limit(50) ->get();
- Chaining:
where,whereHas,whereNotHas,orderByandlimitcan start a query (User::where(...)) or continue one (->where(...)). - Joins:
withJoin(['rel'])loads relations with a LEFT JOIN generated from the relations map, using the chain built so far. toSQL(): returns the SQL and params without running them.
Every adapter of the framework (Deno, PHP, ...) builds the same SQL for the same chain. spec/query_cases.json is the shared contract; it is the same file as the_deno's spec/query_cases.json.
Tests:
php tests/spec_test.phpreplays the spec and needs no database.DBTEST=1 ... php tests/db_test.phpruns the models against a real MySQL or PostgreSQL server. See the file header for the exact command.
Passwords and CORS (the same in every adapter)
spec/auth_cases.json holds the cases for both. The file is the same in the_deno, the_lib and the_go, and each adapter's tests read it.
Passwords: bcrypt, cost 10. A hash made by any adapter logs in through the others.
- Old unsalted SHA3-256 hashes (the_deno base64, the_lib hex) still log in, and are replaced by bcrypt at that login.
- Any length works: bcrypt reads only 72 bytes, so a password over 72 bytes is first reduced to base64(SHA3-256(password)), 44 characters. Every byte counts (a long Hindi passphrase is fine), and the stored hash is still a plain bcrypt string.
- A new password must have 6 to 128 characters (Unicode characters, not bytes). The messages, "Password must be at least 6 characters" and "Password is too long", say nothing about how passwords are stored.
CORS: a switch, off by default.
| Setting | Effect |
|---|---|
CORS unset or off |
no other site may call the API with cookies; same-origin setups need nothing |
CORS=on |
other sites may: any origin, for development |
CORS=on with CORS_ORIGINS=https://a.com,https://b.com |
only those origins, for production |
In PHP these settings are the constants cors and cors_origins (in env.php), or the environment variables. The\Password and The\Cors implement them. Tests: php tests/auth_spec_test.php, plus DBTEST=1 ... php tests/auth_db_test.php.