Skip to content

Commit

Permalink
Revert "Move out of the Backend folder; Top-Level composer"
Browse files Browse the repository at this point in the history
This reverts commit c85a2a3.
  • Loading branch information
felix-schindler committed Oct 27, 2022
1 parent 94431e8 commit ad31c0b
Show file tree
Hide file tree
Showing 28 changed files with 28 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
vendor/
/Backend/Libraries/vendor/
.DS_Store
6 changes: 2 additions & 4 deletions .phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
parameters:
level: 6
excludePaths:
- vendor/*
- Backend/Libraries/vendor/*
paths:
- index.php
- Controllers
- Core
- Views
- Backend
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"label": "PHPStan",
"type": "shell",
"command": "php vendor/bin/phpstan analyse -c .phpstan.neon --memory-limit 500M",
"command": "php Backend/Libraries/vendor/bin/phpstan analyse -c .phpstan.neon --memory-limit 500M",
"group": {
"kind": "build",
"isDefault": true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions Core/Data/Database.php → Backend/Core/Data/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public function execute(string $queryStr, array $values): bool
* Reads data (row by row) from database
* Access returned value via $return['ColumnName']
*
* This should be executed if only one
* row is returned or in a do-while loop
*
* @see https://bugs.php.net/bug.php?edit=2&id=44341 Always string values!
* @throws PDOException When anything goes wrong
* @return array<string,string>|null Result as array - null on failure
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions Backend/Libraries/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"phpstan/phpstan": "^1.2"
}
}
6 changes: 2 additions & 4 deletions composer.lock → Backend/Libraries/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 10 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
# Router

Since I'm mostly using [SvelteKit](https://github.com/sveltejs/kit) and
[PocketBase](https://github.com/pocketbase/pocketbase), this Router is no longer
actively maintained. When I'm bored, I might fix / improve a few things.
Since I'm mostly using [SvelteKit](https://github.com/sveltejs/kit) and [PocketBase](https://github.com/pocketbase/pocketbase), this Router is no longer maintained. Maybe when I'm getting bored, I'll fix / improve one or two things.

## Why use this?

- Dependency-free
- MVC
- No Models included, but you use PDO with the
[Query class](/Core/Data/Query.php) and
[Database class](/Core/Data/Database.php)
- Easy to use readable URLs like "/u/:name" instead of things like
"user.php?name="
- No Models included, but you use PDO with the [Query class](/Backend/Core/Data/Query.php)
- Easy to use readable URLs like "/u/:name" instead of things like "user.php?name="

## Getting started

1. Clone GitHub Repo -
`git clone git@github.com:felix-schindler/Router.git && cd Router`
2. (Run `composer install` if you want to use `phpstan`)
3. Run `php -S localhost:8080` or throw it on a web server
1. Clone GitHub Repo - `git clone git@github.com:felix-schindler/Router.git && cd Router`
2. Run `php -S localhost:8080` or throw it on a web server

## Requirements

- [PHP 8.1](https://www.php.net) with
[PDO](https://www.php.net/manual/de/book.pdo.php)
- **OPTIONAL**: [Composer](https://getcomposer.org)
- [PHP 8.1](https://www.php.net) with [PDO](https://www.php.net/manual/de/book.pdo.php)
- __OPTIONAL__: [Composer](https://getcomposer.org)

## Remove junk

This router is dependency-free. The only composer package installed is
[PHPStan](https://phpstan.org), for static code analysis. Remove composer with
This router is dependency-free. The only composer package installed is [PHPStan](https://phpstan.org), for static code analysis. Remove composer with

```zsh
rm -rf composer* vendor/ .phpstan.neon
rm -rf Backend/Libraries
rm .phpstan.neon
```

and remove the autoloader from the `index.php` file.
Expand Down
6 changes: 0 additions & 6 deletions composer.json

This file was deleted.

14 changes: 7 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

$GLOBALS['start'] = microtime(true); // Meassure execution time -> look in Layout <footer>

Expand All @@ -18,14 +18,14 @@
define("DB_USER", "user");
define("DB_PASS", "pass");

define("TITLE", "Sample"); // Title for website
define("DOMAIN", "https://schindlerfelix.de"); // Hosted on this domain
define("TITLE", "Sample"); // Title for website
define("DOMAIN", "https://schindlerfelix.de"); // Hosted on this domain

// Require autoloaders
require_once("./Core/ClassLoader.php"); // Load classes
// require_once("./vendor/autoload.php"); // Composer autoloader
require_once("./Backend/Core/ClassLoader.php"); // Load classes
// require_once("./Backend/Libraries/vendor/autoload.php"); // Composer autoloader

// Application start
// session_start(); // Start PHP Session (should only be executed if you use session variables)
// session_start(); // Start PHP Session
ClassLoader::파람(); // Run the class loader
Router::艳颖(); // Run router
Router::艳颖(); // Run router

0 comments on commit ad31c0b

Please sign in to comment.