Skip to content

Commit

Permalink
Merge pull request #36 from divineniiquaye/v2
Browse files Browse the repository at this point in the history
Version 2 Release
  • Loading branch information
divineniiquaye authored Oct 10, 2022
2 parents d458895 + 058addb commit cddc624
Show file tree
Hide file tree
Showing 70 changed files with 4,834 additions and 7,731 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['8.0', '8.1', '8.2']

runs-on: ${{ matrix.operating-system }}

Expand All @@ -27,38 +27,23 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, curl
extensions: mbstring, xml, ctype, iconv, curl, fileinfo
coverage: xdebug
tools: composer:v2

- name: Get composer cache directory
id: composercache
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --optimize-autoloader

- name: Run unit tests (PHPUnit)
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

- name: "Upload coverage report to Codecov"
uses: codecov/codecov-action@v2
continue-on-error: true
with:
files: ./coverage.clover

- name: "Upload coverage report to CodeClimate"
uses: paambaati/codeclimate-action@v3.0.0
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: composer install --no-progress --optimize-autoloader ${{ 8.2 == matrix.php-versions && '--ignore-platform-reqs' || '' }}

- name: Check coding standards (PHP_CodeSniffer)
run: vendor/bin/phpcs
Expand All @@ -70,12 +55,27 @@ jobs:
run: vendor/bin/psalm --output-format=github --taint-analysis --shepherd --report=build/logs/psalm.sarif

- name: "Upload security analysis results to GitHub"
uses: "github/codeql-action/upload-sarif@v1"
uses: "github/codeql-action/upload-sarif@v2"
with:
sarif_file: "build/logs/psalm.sarif"

- name: Run unit tests (Pest)
run: vendor/bin/pest --coverage --coverage-clover=coverage.clover

- name: "Upload coverage report to Codecov"
uses: codecov/codecov-action@v2
continue-on-error: true
with:
files: ./coverage.clover

- name: "Upload coverage report to CodeClimate"
uses: paambaati/codeclimate-action@v3.0.0
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

- name: "Benchmark for Performance"
if: matrix.operating-system != 'macos-latest'
run: |
composer require phpbench/phpbench -W
composer require phpbench/phpbench -W --dev ${{ 8.2 == matrix.php-versions && '--ignore-platform-reqs' || '' }}
vendor/bin/phpbench run --report=default -l none
273 changes: 273 additions & 0 deletions BENCHMARK.txt

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
CHANGELOG
=========

2.0
===

* [BC BREAK] Removed the route class to use array instead of object
* [BC BREAK] Removed the route matcher class to use only the `Flight\Routing\Router` class for route matching
* [BC BREAK] Removed the `buildRoutes` method from the route collection class, use the `getRoutes` method directly
* [BC BREAK] Removed the `getRoute` method from the route collection class, use the `offGet` method instead
* [BC BREAK] Removed the `routes` method from the route collection class with no replacement
* [BC BREAK] Removed the `addRoute` method from the route collection class, use the `add` method instead
* [BC BREAK] Removed the `isCached` and `addRoute` methods from the default router class
* [BC BREAK] Removed classes, traits and class methods which are unnecessary or affects performance of routing
* [BC BREAK] Improved the route collection class to use array based routes instead of objects
* [BC BREAK] Improved how the default route handler handles array like callable handlers
* [BC BREAK] Replaced the route matcher implementation in the router class for compiler's implementation instead
* [BC BREAK] Replaced unmatched route host exception to instead return null and a route not found exception
* [BC BREAK] Renamed the `Flight\Routing\Generator\GeneratedUri` class to `Flight\Routing\RouteUri`
* Removed `symfony/var-exporter` library support from caching support, using PHP `var-export` function instead
* Added a new `FileHandler` handler class to return contents from a valid file as PSR-7 response
* Added new sets of requirements to the `Flight\Routing\RouteCompiler::SEGMENT_TYPES` constant
* Added a `offGet` method to the route collection class for finding route by it index number
* Added PHP `Countable` support to the route collection class, for faster routes count
* Added PHP `ArrayAccess` support to the route collection class for easier access to routes
* Added support for the default route compiler placeholder's default rule from `\w+` to `.*?`
* Added a static `export` method to the default router class to export php values in a well formatted way for caching
* Improved the route annotation's listener and attribute class for better performance
* Improved the default route matcher's `generateUri` method reversing a route path and strictly matching parameters
* Improved the default route matcher's class `Flight\Routing\Router::match()` method for better performance
* Improved the default route handler's class for easier extending of route handler and arguments rendering
* Improved the default route handler's class ability to detect content type of string
* Improved and fixed route namespacing issues
* Improved thrown exceptions messages for better debugging of errors
* Improved the sorting of routes in the route's collection class
* Improved the `README.md` doc file for better understanding on how to use this library
* Improved coding standard in making the codebase more readable
* Improved benchmarking scenarios for better performance comparison
* Improved performance tremendously, see [Benchmark Results](./BENCHMARK.txt)
* Updated all tests units rewritten with `pestphp/pest` for easier maintenance and improved benchmarking
* Updated minimum requirement for installing this library to PHP 8.0

1.6
===

Expand Down
Loading

0 comments on commit cddc624

Please sign in to comment.