create-prisma-php-app 1.8.6 → 1.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.env +7 -7
- package/dist/bootstrap.php +13 -23
- package/dist/index.js +748 -1
- package/dist/prisma-client-php/index.enc +1 -1
- package/dist/src/Lib/Prisma/Classes/Validator.php +4 -0
- package/dist/src/app/api/api.php +5 -6
- package/package.json +1 -1
package/dist/.env
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
|
|
8
8
|
|
|
9
9
|
# PHPMailer
|
|
10
|
-
SMTP_HOST=
|
|
11
|
-
SMTP_USERNAME=
|
|
12
|
-
SMTP_PASSWORD=
|
|
13
|
-
SMTP_PORT=
|
|
14
|
-
SMTP_ENCRYPTION=ssl
|
|
15
|
-
MAIL_FROM=
|
|
16
|
-
MAIL_FROM_NAME=""
|
|
10
|
+
# SMTP_HOST=smtp.gmail.com or your SMTP host
|
|
11
|
+
# SMTP_USERNAME=john.doe@gmail.com or your SMTP username
|
|
12
|
+
# SMTP_PASSWORD=123456
|
|
13
|
+
# SMTP_PORT=587 for TLS, 465 for SSL or your SMTP port
|
|
14
|
+
# SMTP_ENCRYPTION=ssl or tls
|
|
15
|
+
# MAIL_FROM=john.doe@gmail.com
|
|
16
|
+
# MAIL_FROM_NAME="John Doe"
|
package/dist/bootstrap.php
CHANGED
|
@@ -24,7 +24,7 @@ function determineContentToInclude()
|
|
|
24
24
|
$includePath = '';
|
|
25
25
|
$metadata = $metadata[$uri] ?? $metadata['default'];
|
|
26
26
|
writeRoutes();
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
$isDirectAccessToPrivateRoute = preg_match('/^_/', $uri);
|
|
29
29
|
if ($isDirectAccessToPrivateRoute) {
|
|
30
30
|
return ['path' => $includePath];
|
|
@@ -109,27 +109,17 @@ function writeRoutes()
|
|
|
109
109
|
function findGroupFolder($uri): string
|
|
110
110
|
{
|
|
111
111
|
$uriSegments = explode('/', $uri);
|
|
112
|
-
$constructedPath = '';
|
|
113
|
-
$groupFolder = '';
|
|
114
|
-
$finalMatch = '';
|
|
115
|
-
|
|
116
112
|
foreach ($uriSegments as $segment) {
|
|
117
113
|
if (!empty($segment)) {
|
|
118
114
|
if (isGroupIdentifier($segment)) {
|
|
119
115
|
return $segment;
|
|
120
116
|
}
|
|
121
|
-
|
|
122
|
-
$constructedPath .= (empty($constructedPath) ? '' : '/') . $segment;
|
|
123
|
-
$matchedGroupFolder = matchGroupFolder($constructedPath);
|
|
124
|
-
if ($matchedGroupFolder) {
|
|
125
|
-
$groupFolder = $matchedGroupFolder;
|
|
126
|
-
$finalMatch = $groupFolder;
|
|
127
|
-
}
|
|
128
117
|
}
|
|
129
118
|
}
|
|
130
119
|
|
|
131
|
-
|
|
132
|
-
|
|
120
|
+
$matchedGroupFolder = matchGroupFolder($uri);
|
|
121
|
+
if ($matchedGroupFolder) {
|
|
122
|
+
return $matchedGroupFolder;
|
|
133
123
|
} else {
|
|
134
124
|
return '';
|
|
135
125
|
}
|
|
@@ -144,22 +134,22 @@ function matchGroupFolder($constructedPath): ?string
|
|
|
144
134
|
{
|
|
145
135
|
$routes = json_decode(file_get_contents(SETTINGS_PATH . "/files_list.json"), true);
|
|
146
136
|
$bestMatch = null;
|
|
137
|
+
$normalizedConstructedPath = ltrim(str_replace('\\', '/', $constructedPath), './');
|
|
138
|
+
|
|
139
|
+
if (substr($normalizedConstructedPath, -4) !== '.php') {
|
|
140
|
+
$normalizedConstructedPath = "/$normalizedConstructedPath/index.php";
|
|
141
|
+
}
|
|
147
142
|
|
|
148
143
|
foreach ($routes as $route) {
|
|
149
144
|
$normalizedRoute = trim(str_replace('\\', '/', $route), '.');
|
|
150
145
|
$cleanedRoute = preg_replace('/\/\([^)]+\)/', '', $normalizedRoute);
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
146
|
+
if ($cleanedRoute === $normalizedConstructedPath) {
|
|
147
|
+
$bestMatch = $normalizedRoute;
|
|
148
|
+
break;
|
|
155
149
|
}
|
|
156
150
|
}
|
|
157
151
|
|
|
158
|
-
|
|
159
|
-
return $bestMatch;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return null;
|
|
152
|
+
return $bestMatch;
|
|
163
153
|
}
|
|
164
154
|
|
|
165
155
|
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
|