Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsonjohn committed Dec 23, 2024
1 parent d736b72 commit b8e5998
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 91 deletions.
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/01-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ⚠️️ Bug report
description: Report a bug
title: "[BUG]: "
labels: ["Type: Bug"]
body:
- type: markdown
attributes:
value: |
To report a bug, complete the form below.
- type: input
attributes:
label: Project version
description: Version of this project in which the bug exists
placeholder: vX.X.X
validations:
required: true
- type: textarea
attributes:
label: Description
description: Detailed description of the bug
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: A summary of what you expected, should this issue not have arisen
- type: textarea
attributes:
label: Possible solution
description: Possible solution/fix to this issue
- type: textarea
attributes:
label: Steps to reproduce
description: Can provide links to a live example, code snippets, screenshots, or simple steps to reproduce this bug
- type: textarea
attributes:
label: Environment
description: Details of the environment which experienced this bug
- type: textarea
attributes:
label: Additional information
description: Additional information/details
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/02-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 🛠️ Feature request
description: Request a new feature
title: "[FEATURE]: "
labels: ["Type: Feature"]
body:
- type: markdown
attributes:
value: |
To request a new feature, complete the form below.
- type: input
attributes:
label: Current project version
description: Latest release of this project to-date
placeholder: vX.X.X
validations:
required: true
- type: textarea
attributes:
label: Description
description: Description of the proposed feature
validations:
required: true
- type: textarea
attributes:
label: Scenario/use-case
description: Explain how/when the feature would be helpful
- type: textarea
attributes:
label: Possible solution
description: Possible solution to implement this feature
- type: textarea
attributes:
label: Additional information
description: Additional information/details
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/03-question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ❓ Question
description: Ask a question
title: "[QUESTION]: "
labels: ["Type: Question"]
body:
- type: markdown
attributes:
value: |
To ask a question, complete the form below.
- type: input
attributes:
label: Current project version
description: Latest release of this project to-date
placeholder: vX.X.X
validations:
required: true
- type: textarea
attributes:
label: Description
description: Description of the question
validations:
required: true
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/04-other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 📄 Other
description: All other issues
title: "[OTHER]: "
labels: ["Type: Other"]
body:
- type: markdown
attributes:
value: |
To create a new issue, complete the form below.
- type: input
attributes:
label: Project version
description: Version of this project for which this issue applies (if applicable)
placeholder: vX.X.X
- type: textarea
attributes:
label: Description
description: Issue details
validations:
required: true
44 changes: 0 additions & 44 deletions .github/ISSUE_TEMPLATE/Bug.md

This file was deleted.

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/Feature_Request.md

This file was deleted.

8 changes: 0 additions & 8 deletions .github/ISSUE_TEMPLATE/Question.md

This file was deleted.

1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
3 changes: 2 additions & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

**PLEASE DO NOT DISCLOSE SECURITY-RELATED ISSUES PUBLICLY**

If you discover a security vulnerability, please send an email to [email protected]. All security vulnerabilities will be promptly addressed.
If you discover a security vulnerability, please email [email protected].
All security vulnerabilities will be promptly addressed.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities

## [3.1.4] - 2024.12.23

### Added

- Tested up to PHP v8.4.
- Updated GitHub issue templates.

### Removed

- Removed unneeded dependency `php-string-helpers`

## [3.1.3] - 2024.09.09

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This project is open source and available under the [MIT License](LICENSE).

## Requirements

* PHP `^8.0`
* PHP `^8.0` (Tested up to `8.4`)
* ctype PHP extension

## Installation
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"ext-ctype": "*",
"bayfrontmedia/php-array-helpers": "^2.0",
"bayfrontmedia/php-http-request": "^3.1",
"bayfrontmedia/php-http-response": "^2.0",
"bayfrontmedia/php-string-helpers": "^2.0"
"bayfrontmedia/php-http-response": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
33 changes: 16 additions & 17 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Bayfront\HttpRequest\Request;
use Bayfront\HttpResponse\InvalidStatusCodeException;
use Bayfront\HttpResponse\Response;
use Bayfront\StringHelpers\Str;

class Router
{
Expand Down Expand Up @@ -283,7 +282,7 @@ public function getRedirects(): array
* @return self
*/

public function addRoute(array|string $methods, string $path, mixed $destination, array $params = [], string $name = NULL): self
public function addRoute(array|string $methods, string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{

foreach ((array)$methods as $method) {
Expand Down Expand Up @@ -316,7 +315,7 @@ public function addRoute(array|string $methods, string $path, mixed $destination
* @return self
*/

public function any(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function any(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(self::METHOD_ANY, $path, $destination, $params, $name);
}
Expand All @@ -332,7 +331,7 @@ public function any(string $path, mixed $destination, array $params = [], string
* @return self
*/

public function connect(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function connect(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_CONNECT, $path, $destination, $params, $name);
}
Expand All @@ -348,7 +347,7 @@ public function connect(string $path, mixed $destination, array $params = [], st
* @return self
*/

public function delete(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function delete(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_DELETE, $path, $destination, $params, $name);
}
Expand All @@ -364,7 +363,7 @@ public function delete(string $path, mixed $destination, array $params = [], str
* @return self
*/

public function get(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function get(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_GET, $path, $destination, $params, $name);
}
Expand All @@ -380,7 +379,7 @@ public function get(string $path, mixed $destination, array $params = [], string
* @return self
*/

public function head(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function head(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_HEAD, $path, $destination, $params, $name);
}
Expand All @@ -396,7 +395,7 @@ public function head(string $path, mixed $destination, array $params = [], strin
* @return self
*/

public function options(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function options(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_OPTIONS, $path, $destination, $params, $name);
}
Expand All @@ -412,7 +411,7 @@ public function options(string $path, mixed $destination, array $params = [], st
* @return self
*/

public function patch(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function patch(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_PATCH, $path, $destination, $params, $name);
}
Expand All @@ -428,7 +427,7 @@ public function patch(string $path, mixed $destination, array $params = [], stri
* @return self
*/

public function post(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function post(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_POST, $path, $destination, $params, $name);
}
Expand All @@ -444,7 +443,7 @@ public function post(string $path, mixed $destination, array $params = [], strin
* @return self
*/

public function put(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function put(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_PUT, $path, $destination, $params, $name);
}
Expand All @@ -460,7 +459,7 @@ public function put(string $path, mixed $destination, array $params = [], string
* @return self
*/

public function trace(string $path, mixed $destination, array $params = [], string $name = NULL): self
public function trace(string $path, mixed $destination, array $params = [], ?string $name = NULL): self
{
return $this->addRoute(Request::METHOD_TRACE, $path, $destination, $params, $name);
}
Expand Down Expand Up @@ -858,7 +857,7 @@ public function dispatchTo(mixed $destination, array $params = []): mixed

// If to a file

if (Str::startsWith($destination, '@')) {
if (str_starts_with($destination, '@')) {

$file = $this->options['files_root_path'] . '/' . ltrim($destination, '@');

Expand All @@ -882,7 +881,7 @@ public function dispatchTo(mixed $destination, array $params = []): mixed

if (isset($loc[1])) { // Dispatch to Class:method

if ($this->options['class_namespace'] == '' || Str::startsWith($loc[0], $this->options['class_namespace'])) {
if ($this->options['class_namespace'] == '' || str_starts_with($loc[0], $this->options['class_namespace'])) {

$class_name = $loc[0];

Expand Down Expand Up @@ -998,7 +997,7 @@ public function redirect(string $url, int $status = 302): void
protected function _getAutomapDestination(array $this_request): array
{

if (Str::startsWith($this_request['path'], $this->options['automapping_route_prefix'])) {
if (str_starts_with($this_request['path'], $this->options['automapping_route_prefix'])) {

$segments = explode('/', trim(str_replace($this->options['automapping_route_prefix'], '', $this_request['path']), '/'));

Expand Down Expand Up @@ -1186,8 +1185,8 @@ protected function _getWildcardMatch(array $route_arr, string $request_path): ar
*/

if (count($route_segments) !== count($request_segments) &&
!Str::has(end($route_segments), '{**:') &&
!Str::has(end($route_segments), '{?:')
!str_contains(end($route_segments), '{**:') &&
!str_contains(end($route_segments), '{?:')
) { // Match impossibility

continue; // This route does not match - continue to next iteration
Expand Down

0 comments on commit b8e5998

Please sign in to comment.