|
@@ -1,11 +1,9 @@
|
1
|
|
-# PHP-CRUD-API (v2)
|
|
1
|
+# PHP-CRUD-API
|
2
|
2
|
|
3
|
|
-Single file PHP 7 script that adds a REST API to a MySQL 5.5 InnoDB database. PostgreSQL 9.1 and MS SQL Server 2012 are fully supported.
|
|
3
|
+Single file PHP 7 script that adds a REST API to a MySQL 5.6 InnoDB database. PostgreSQL 9.1 and MS SQL Server 2012 are fully supported.
|
4
|
4
|
|
5
|
5
|
NB: This is the [TreeQL](https://treeql.org) reference implementation in PHP.
|
6
|
6
|
|
7
|
|
-NB: Are you looking for v1? It is here: https://github.com/mevdschee/php-crud-api/tree/v1
|
8
|
|
-
|
9
|
7
|
Related projects:
|
10
|
8
|
|
11
|
9
|
- [PHP-API-AUTH](https://github.com/mevdschee/php-api-auth): Single file PHP script that is an authentication provider for PHP-CRUD-API (v2)
|
|
@@ -91,7 +89,7 @@ NB: The script appends the classes in alphabetical order (directories first).
|
91
|
89
|
|
92
|
90
|
## Limitations
|
93
|
91
|
|
94
|
|
-These limitation were also present in v1:
|
|
92
|
+These limitation and constrains apply:
|
95
|
93
|
|
96
|
94
|
- Primary keys should either be auto-increment (from 1 to 2^53) or UUID
|
97
|
95
|
- Composite primary or foreign keys are not supported
|
|
@@ -101,38 +99,30 @@ These limitation were also present in v1:
|
101
|
99
|
|
102
|
100
|
## Features
|
103
|
101
|
|
104
|
|
-These features match features in v1 (see branch "v1"):
|
105
|
|
-
|
106
|
|
- - [x] Single PHP file, easy to deploy.
|
107
|
|
- - [x] Very little code, easy to adapt and maintain
|
108
|
|
- - [ ] ~~Streaming data, low memory footprint~~
|
109
|
|
- - [x] Supports POST variables as input (x-www-form-urlencoded)
|
110
|
|
- - [x] Supports a JSON object as input
|
111
|
|
- - [x] Supports a JSON array as input (batch insert)
|
112
|
|
- - [ ] ~~Supports file upload from web forms (multipart/form-data)~~
|
113
|
|
- - [ ] ~~Condensed JSON output: first row contains field names~~
|
114
|
|
- - [x] Sanitize and validate input using callbacks
|
115
|
|
- - [x] Permission system for databases, tables, columns and records
|
116
|
|
- - [x] Multi-tenant database layouts are supported
|
117
|
|
- - [x] Multi-domain CORS support for cross-domain requests
|
118
|
|
- - [x] Support for reading joined results from multiple tables
|
119
|
|
- - [x] Search support on multiple criteria
|
120
|
|
- - [x] Pagination, seeking, sorting and column selection
|
121
|
|
- - [x] Relation detection with nested results (belongsTo, hasMany and HABTM)
|
122
|
|
- - [ ] ~~Relation "transforms" (of condensed JSON) for PHP and JavaScript~~
|
123
|
|
- - [x] Atomic increment support via PATCH (for counters)
|
124
|
|
- - [x] Binary fields supported with base64 encoding
|
125
|
|
- - [x] Spatial/GIS fields and filters supported with WKT
|
126
|
|
- - [ ] ~~Unstructured data support through JSON/JSONB~~
|
127
|
|
- - [x] Generate API documentation using OpenAPI tools
|
128
|
|
- - [x] Authentication via JWT token or username/password
|
129
|
|
- - [ ] ~~SQLite support~~
|
130
|
|
-
|
131
|
|
- NB: No checkmark means: not yet implemented. Striken means: will not be implemented.
|
|
102
|
+The following features are supported:
|
|
103
|
+
|
|
104
|
+ - Single PHP file, easy to deploy.
|
|
105
|
+ - Very little code, easy to adapt and maintain
|
|
106
|
+ - Supports POST variables as input (x-www-form-urlencoded)
|
|
107
|
+ - Supports a JSON object as input
|
|
108
|
+ - Supports a JSON array as input (batch insert)
|
|
109
|
+ - Sanitize and validate input using callbacks
|
|
110
|
+ - Permission system for databases, tables, columns and records
|
|
111
|
+ - Multi-tenant database layouts are supported
|
|
112
|
+ - Multi-domain CORS support for cross-domain requests
|
|
113
|
+ - Support for reading joined results from multiple tables
|
|
114
|
+ - Search support on multiple criteria
|
|
115
|
+ - Pagination, seeking, sorting and column selection
|
|
116
|
+ - Relation detection with nested results (belongsTo, hasMany and HABTM)
|
|
117
|
+ - Atomic increment support via PATCH (for counters)
|
|
118
|
+ - Binary fields supported with base64 encoding
|
|
119
|
+ - Spatial/GIS fields and filters supported with WKT
|
|
120
|
+ - Generate API documentation using OpenAPI tools
|
|
121
|
+ - Authentication via JWT token or username/password
|
132
|
122
|
|
133
|
123
|
### Extra Features
|
134
|
124
|
|
135
|
|
-These features are new and were not included in v1.
|
|
125
|
+These features are new in v2 and were not included in v1:
|
136
|
126
|
|
137
|
127
|
- Does not reflect on every request (better performance)
|
138
|
128
|
- Complex filters (with both "and" & "or") are supported
|
|
@@ -144,6 +134,19 @@ These features are new and were not included in v1.
|
144
|
134
|
- Support for basic authentication and via auth provider (JWT)
|
145
|
135
|
- Support for basic firewall functionality
|
146
|
136
|
|
|
137
|
+### Dropped features
|
|
138
|
+
|
|
139
|
+The following features of v1 were dropped in v2:
|
|
140
|
+
|
|
141
|
+ - ~~Streaming data, low memory footprint~~
|
|
142
|
+ - ~~Supports file upload from web forms (multipart/form-data)~~
|
|
143
|
+ - ~~Condensed JSON output: first row contains field names~~
|
|
144
|
+ - ~~Relation "transforms" (of condensed JSON) for PHP and JavaScript~~
|
|
145
|
+ - ~~Unstructured data support through JSON/JSONB~~
|
|
146
|
+ - ~~SQLite support~~
|
|
147
|
+
|
|
148
|
+NB: You can find v1 here: https://github.com/mevdschee/php-crud-api/tree/v1
|
|
149
|
+
|
147
|
150
|
## Middleware
|
148
|
151
|
|
149
|
152
|
You can enable the following middleware using the "middlewares" config parameter:
|