create-prisma-php-app 1.11.601 → 1.12.0
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/.dockerignore +2 -0
- package/dist/Dockerfile +40 -0
- package/dist/apache.conf +12 -0
- package/dist/bootstrap.php +10 -2
- package/dist/docker-compose.yml +19 -0
- package/dist/index.js +1 -783
- package/dist/prisma-php.js +3 -63
- package/dist/src/Lib/FormHandler.php +854 -19
- package/dist/src/app/js/index.js +16 -7
- package/dist/src/app/layout.php +1 -0
- package/package.json +1 -1
package/dist/Dockerfile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Use an official PHP image with the version you need
|
|
2
|
+
FROM php:8.1-apache
|
|
3
|
+
|
|
4
|
+
# Install system dependencies for Composer and PHP extensions
|
|
5
|
+
RUN apt-get update && apt-get install -y \
|
|
6
|
+
git \
|
|
7
|
+
unzip \
|
|
8
|
+
libzip-dev \
|
|
9
|
+
zip \
|
|
10
|
+
&& docker-php-ext-install pdo_mysql zip
|
|
11
|
+
|
|
12
|
+
# Enable Apache mods
|
|
13
|
+
RUN a2enmod rewrite headers
|
|
14
|
+
|
|
15
|
+
# Install Composer globally
|
|
16
|
+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
|
|
17
|
+
|
|
18
|
+
# Set the working directory in the container
|
|
19
|
+
WORKDIR /var/www/html
|
|
20
|
+
|
|
21
|
+
# Copy the application's composer.json and lock file
|
|
22
|
+
COPY composer.json composer.lock ./
|
|
23
|
+
|
|
24
|
+
# Install PHP dependencies
|
|
25
|
+
RUN composer install --no-scripts --no-autoloader
|
|
26
|
+
|
|
27
|
+
# Copy the rest of the application
|
|
28
|
+
COPY . .
|
|
29
|
+
|
|
30
|
+
# Finish composer
|
|
31
|
+
RUN composer dump-autoload --optimize
|
|
32
|
+
|
|
33
|
+
# Apache config
|
|
34
|
+
COPY ./apache.conf /etc/apache2/sites-available/000-default.conf
|
|
35
|
+
|
|
36
|
+
# Expose port 80 to access the container
|
|
37
|
+
EXPOSE 80
|
|
38
|
+
|
|
39
|
+
# Command to run when starting the container
|
|
40
|
+
CMD ["apache2-foreground"]
|
package/dist/apache.conf
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<VirtualHost *:80>
|
|
2
|
+
ServerAdmin webmaster@localhost
|
|
3
|
+
DocumentRoot /var/www/html
|
|
4
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
|
5
|
+
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
6
|
+
|
|
7
|
+
<Directory "/var/www/html">
|
|
8
|
+
Options Indexes FollowSymLinks
|
|
9
|
+
AllowOverride All
|
|
10
|
+
Require all granted
|
|
11
|
+
</Directory>
|
|
12
|
+
</VirtualHost>
|
package/dist/bootstrap.php
CHANGED
|
@@ -25,9 +25,17 @@ function determineContentToInclude()
|
|
|
25
25
|
writeRoutes();
|
|
26
26
|
AuthMiddleware::handle($uri);
|
|
27
27
|
|
|
28
|
-
$isDirectAccessToPrivateRoute = preg_match('
|
|
28
|
+
$isDirectAccessToPrivateRoute = preg_match('/\/_/', $uri);
|
|
29
29
|
if ($isDirectAccessToPrivateRoute) {
|
|
30
|
-
|
|
30
|
+
$sameSiteFetch = false;
|
|
31
|
+
$serverFetchSite = $_SERVER['HTTP_SEC_FETCH_SITE'] ?? '';
|
|
32
|
+
if (isset($serverFetchSite) && $serverFetchSite === 'same-origin') {
|
|
33
|
+
$sameSiteFetch = true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!$sameSiteFetch) {
|
|
37
|
+
return ['path' => $includePath, 'layouts' => $layoutsToInclude, 'uri' => $uri];
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
if ($uri) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
version: "3.8"
|
|
2
|
+
services:
|
|
3
|
+
web:
|
|
4
|
+
build:
|
|
5
|
+
context: .
|
|
6
|
+
dockerfile: Dockerfile
|
|
7
|
+
ports:
|
|
8
|
+
- "80:80"
|
|
9
|
+
volumes:
|
|
10
|
+
- .:/var/www/html
|
|
11
|
+
depends_on:
|
|
12
|
+
- db
|
|
13
|
+
db:
|
|
14
|
+
image: mysql:5.7
|
|
15
|
+
environment:
|
|
16
|
+
MYSQL_ROOT_PASSWORD: prisma_php
|
|
17
|
+
MYSQL_DATABASE: prisma_php
|
|
18
|
+
ports:
|
|
19
|
+
- "3306:3306"
|