From a46ba1dd4ec0633a3e1e908e40a638e6ca186cb8 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Sat, 9 Jul 2022 12:50:24 -0400 Subject: [PATCH] Initial project structure with Composer --- .gitignore | 1 + .htaccess | 19 +++++++++++++++++++ bin/dev-server.sh | 7 +++++++ composer.json | 18 ++++++++++++++++++ logs/.gitkeep | 0 phpcs.xml | 17 +++++++++++++++++ phpstan.neon.dist | 4 ++++ phpunit.xml | 27 +++++++++++++++++++++++++++ public/.htaccess | 34 ++++++++++++++++++++++++++++++++++ 9 files changed, 127 insertions(+) create mode 100644 .gitignore create mode 100644 .htaccess create mode 100755 bin/dev-server.sh create mode 100644 composer.json create mode 100644 logs/.gitkeep create mode 100644 phpcs.xml create mode 100644 phpstan.neon.dist create mode 100644 phpunit.xml create mode 100644 public/.htaccess diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..c7552bf --- /dev/null +++ b/.htaccess @@ -0,0 +1,19 @@ +Options All -Indexes + + +order allow,deny +deny from all + + + + # Redirect to the public folder + RewriteEngine On + # RewriteBase / + RewriteRule ^$ public/ [L] + RewriteRule (.*) public/$1 [L] + + # Redirect to HTTPS + # RewriteEngine On + # RewriteCond %{HTTPS} off + # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + diff --git a/bin/dev-server.sh b/bin/dev-server.sh new file mode 100755 index 0000000..9c804c9 --- /dev/null +++ b/bin/dev-server.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# cd into the correct directory +cd "$( dirname "$0" )"/.. + +# launch the PHP dev server +php -S localhost:8080 -t public public/index.php diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..135ce64 --- /dev/null +++ b/composer.json @@ -0,0 +1,18 @@ +{ + "name": "bitgoblin/bitgoblin-website", + "description": "Bit Goblin main website", + "type": "project", + "license": "BSD-2-Clause", + "autoload": { + "psr-4": { + "Bitgoblin\\BitgoblinWebsite\\": "src/" + } + }, + "authors": [ + { + "name": "Gregory Ballantine", + "email": "gballantine@bitgoblin.tech" + } + ], + "require": {} +} diff --git a/logs/.gitkeep b/logs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..72e9907 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,17 @@ + + + Slim coding standard + + + + + + + + + + + + src + tests + \ No newline at end of file diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..2e09595 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,4 @@ +parameters: + level: 4 + paths: + - src diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..f830400 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,27 @@ + + + + ./tests/ + + + + + ./src/ + + + diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..fe74ec5 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,34 @@ +Options All -Indexes + + +order allow,deny +deny from all + + + + RewriteEngine On + + # Redirect to HTTPS + # RewriteEngine On + # RewriteCond %{HTTPS} off + # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + + # Some hosts may require you to use the `RewriteBase` directive. + # Determine the RewriteBase automatically and set it as environment variable. + # If you are using Apache aliases to do mass virtual hosting or installed the + # project in a subdirectory, the base path will be prepended to allow proper + # resolution of the index.php file and to redirect to the correct URI. It will + # work in environments without path prefix as well, providing a safe, one-size + # fits all solution. But as you do not need it in this case, you can comment + # the following 2 lines to eliminate the overhead. + RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ + RewriteRule ^(.*) - [E=BASE:%1] + + # If the above doesn't work you might need to set the `RewriteBase` directive manually, it should be the + # absolute physical path to the directory that contains this htaccess file. + # RewriteBase / + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [QSA,L] +