1
1
# PHP-CRUD-API
2
2
3
- Single file PHP 7 script that adds a REST API to a MySQL/MariaDB, PostgreSQL, SQL Server or SQLite database.
3
+ Single file PHP script that adds a REST API to a MySQL/MariaDB, PostgreSQL, SQL Server or SQLite database.
4
4
5
5
NB: This is the [ TreeQL] ( https://treeql.org ) reference implementation in PHP.
6
6
@@ -55,6 +55,9 @@ Alternatively you can integrate this project into the web framework of your choi
55
55
56
56
In these integrations [ Composer] ( https://getcomposer.org/ ) is used to load this project as a dependency.
57
57
58
+ For people that don't use composer, the file "` api.include.php ` " is provided. This file contains everything
59
+ from "` api.php ` " except the configuration from "` src/index.php ` " and can be used by PHP's "include".
60
+
58
61
## Configuration
59
62
60
63
Edit the following lines in the bottom of the file "` api.php ` ":
@@ -1207,7 +1210,7 @@ I am testing mainly on Ubuntu and I have the following test setups:
1207
1210
- (Docker) Ubuntu 18.04 with PHP 7.2, MySQL 5.7, PostgreSQL 10.4 (PostGIS 2.4) and SQLite 3.22
1208
1211
- (Docker) Debian 10 with PHP 7.3, MariaDB 10.3, PostgreSQL 11.4 (PostGIS 2.5) and SQLite 3.27
1209
1212
- (Docker) Ubuntu 20.04 with PHP 7.4, MySQL 8.0, PostgreSQL 12.2 (PostGIS 3.0) and SQLite 3.31
1210
- - (Docker) CentOS 8 with PHP 7.4 , MariaDB 10.5, PostgreSQL 12.5 (PostGIS 3.0) and SQLite 3.26
1213
+ - (Docker) CentOS 8 with PHP 8.0 , MariaDB 10.5, PostgreSQL 12.5 (PostGIS 3.0) and SQLite 3.26
1211
1214
1212
1215
This covers not all environments (yet), so please notify me of failing tests and report your environment.
1213
1216
I will try to cover most relevant setups in the "docker" folder of the project.
@@ -1261,17 +1264,17 @@ Install docker using the following commands and then logout and login for the ch
1261
1264
To run the docker tests run "build_all.sh" and "run_all.sh" from the docker directory. The output should be:
1262
1265
1263
1266
================================================
1264
- CentOS 8 (PHP 7.4 )
1267
+ CentOS 8 (PHP 8.0 )
1265
1268
================================================
1266
1269
[1/4] Starting MariaDB 10.5 ..... done
1267
1270
[2/4] Starting PostgreSQL 12.5 .. done
1268
1271
[3/4] Starting SQLServer 2017 ... skipped
1269
1272
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1270
1273
------------------------------------------------
1271
- mysql: 110 tests ran in 1911 ms, 1 skipped, 0 failed
1272
- pgsql: 110 tests ran in 1112 ms, 1 skipped, 0 failed
1274
+ mysql: 110 tests ran in 957 ms, 1 skipped, 0 failed
1275
+ pgsql: 110 tests ran in 817 ms, 1 skipped, 0 failed
1273
1276
sqlsrv: skipped, driver not loaded
1274
- sqlite: 110 tests ran in 1178 ms, 12 skipped, 0 failed
1277
+ sqlite: 110 tests ran in 685 ms, 12 skipped, 0 failed
1275
1278
================================================
1276
1279
Debian 10 (PHP 7.3)
1277
1280
================================================
@@ -1280,10 +1283,10 @@ To run the docker tests run "build_all.sh" and "run_all.sh" from the docker dire
1280
1283
[3/4] Starting SQLServer 2017 ... skipped
1281
1284
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1282
1285
------------------------------------------------
1283
- mysql: 110 tests ran in 3459 ms, 1 skipped, 0 failed
1284
- pgsql: 110 tests ran in 1134 ms, 1 skipped, 0 failed
1286
+ mysql: 110 tests ran in 952 ms, 1 skipped, 0 failed
1287
+ pgsql: 110 tests ran in 816 ms, 1 skipped, 0 failed
1285
1288
sqlsrv: skipped, driver not loaded
1286
- sqlite: 110 tests ran in 1275 ms, 12 skipped, 0 failed
1289
+ sqlite: 110 tests ran in 690 ms, 12 skipped, 0 failed
1287
1290
================================================
1288
1291
Debian 9 (PHP 7.0)
1289
1292
================================================
@@ -1292,10 +1295,10 @@ To run the docker tests run "build_all.sh" and "run_all.sh" from the docker dire
1292
1295
[3/4] Starting SQLServer 2017 ... skipped
1293
1296
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1294
1297
------------------------------------------------
1295
- mysql: 110 tests ran in 3181 ms, 1 skipped, 0 failed
1296
- pgsql: 110 tests ran in 1201 ms, 1 skipped, 0 failed
1298
+ mysql: 110 tests ran in 1075 ms, 1 skipped, 0 failed
1299
+ pgsql: 110 tests ran in 834 ms, 1 skipped, 0 failed
1297
1300
sqlsrv: skipped, driver not loaded
1298
- sqlite: 110 tests ran in 1414 ms, 12 skipped, 0 failed
1301
+ sqlite: 110 tests ran in 728 ms, 12 skipped, 0 failed
1299
1302
================================================
1300
1303
Ubuntu 16.04 (PHP 7.0)
1301
1304
================================================
@@ -1304,9 +1307,9 @@ To run the docker tests run "build_all.sh" and "run_all.sh" from the docker dire
1304
1307
[3/4] Starting SQLServer 2017 ... done
1305
1308
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1306
1309
------------------------------------------------
1307
- mysql: 110 tests ran in 3168 ms, 1 skipped, 0 failed
1308
- pgsql: 110 tests ran in 1197 ms, 1 skipped, 0 failed
1309
- sqlsrv: 110 tests ran in 10151 ms, 1 skipped, 0 failed
1310
+ mysql: 110 tests ran in 1065 ms, 1 skipped, 0 failed
1311
+ pgsql: 110 tests ran in 845 ms, 1 skipped, 0 failed
1312
+ sqlsrv: 110 tests ran in 5404 ms, 1 skipped, 0 failed
1310
1313
sqlite: skipped, driver not loaded
1311
1314
================================================
1312
1315
Ubuntu 18.04 (PHP 7.2)
@@ -1316,10 +1319,10 @@ To run the docker tests run "build_all.sh" and "run_all.sh" from the docker dire
1316
1319
[3/4] Starting SQLServer 2017 ... skipped
1317
1320
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1318
1321
------------------------------------------------
1319
- mysql: 110 tests ran in 3709 ms, 1 skipped, 0 failed
1320
- pgsql: 110 tests ran in 1334 ms, 1 skipped, 0 failed
1322
+ mysql: 110 tests ran in 1261 ms, 1 skipped, 0 failed
1323
+ pgsql: 110 tests ran in 859 ms, 1 skipped, 0 failed
1321
1324
sqlsrv: skipped, driver not loaded
1322
- sqlite: 110 tests ran in 1477 ms, 12 skipped, 0 failed
1325
+ sqlite: 110 tests ran in 725 ms, 12 skipped, 0 failed
1323
1326
================================================
1324
1327
Ubuntu 20.04 (PHP 7.4)
1325
1328
================================================
@@ -1328,10 +1331,10 @@ To run the docker tests run "build_all.sh" and "run_all.sh" from the docker dire
1328
1331
[3/4] Starting SQLServer 2017 ... skipped
1329
1332
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1330
1333
------------------------------------------------
1331
- mysql: 110 tests ran in 5102 ms, 1 skipped, 0 failed
1332
- pgsql: 110 tests ran in 1170 ms, 1 skipped, 0 failed
1334
+ mysql: 110 tests ran in 1505 ms, 1 skipped, 0 failed
1335
+ pgsql: 110 tests ran in 851 ms, 1 skipped, 0 failed
1333
1336
sqlsrv: skipped, driver not loaded
1334
- sqlite: 110 tests ran in 1380 ms, 12 skipped, 0 failed
1337
+ sqlite: 110 tests ran in 675 ms, 12 skipped, 0 failed
1335
1338
1336
1339
The above test run (including starting up the databases) takes less than 5 minutes on my slow laptop.
1337
1340
@@ -1351,10 +1354,10 @@ The above test run (including starting up the databases) takes less than 5 minut
1351
1354
[3/4] Starting SQLServer 2017 ... skipped
1352
1355
[4/4] Cloning PHP-CRUD-API v2 ... skipped
1353
1356
------------------------------------------------
1354
- mysql: 105 tests ran in 3390 ms, 1 skipped, 0 failed
1355
- pgsql: 105 tests ran in 936 ms, 1 skipped, 0 failed
1357
+ mysql: 110 tests ran in 1261 ms, 1 skipped, 0 failed
1358
+ pgsql: 110 tests ran in 859 ms, 1 skipped, 0 failed
1356
1359
sqlsrv: skipped, driver not loaded
1357
- sqlite: 105 tests ran in 1063 ms, 12 skipped, 0 failed
1360
+ sqlite: 110 tests ran in 725 ms, 12 skipped, 0 failed
1358
1361
root@b7ab9472e08f:/php-crud-api#
1359
1362
1360
1363
As you can see the "run.sh" script gives you access to a prompt in a chosen the docker environment.
0 commit comments