Skip to content

Commit 784ddc2

Browse files
authored
Merge pull request #4 from designcise/4.x
feat: php version bump to 8.2
2 parents 9b75c52 + af3fab3 commit 784ddc2

20 files changed

+3837
-59
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
/.gitattributes export-ignore
55
/.gitignore export-ignore
6-
/.travis.yml export-ignore
76
/phpunit.xml export-ignore
87
/phpstan.neon export-ignore
9-
/test export-ignore
8+
/test export-ignore

.github/scripts/run-phpunit.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
composer test-report

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build-test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Setup PHP
12+
uses: shivammathur/setup-php@v2
13+
with:
14+
php-version: "8.2"
15+
- name: Install dependencies
16+
uses: php-actions/composer@v6
17+
with:
18+
version: 2.5.5
19+
20+
- name: Test & Coverage
21+
uses: paambaati/codeclimate-action@v4.0.0
22+
env:
23+
CC_TEST_REPORTER_ID: b9873e5d887bdd5e654040a0056c2f6ebfbbf5f9b85eaacd26336bf2f27d6628
24+
with:
25+
coverageCommand: ./.github/scripts/run-phpunit.sh
26+
coverageLocations: coverage.xml:clover
27+
debug: true
28+
29+
- name: Clean up GitHub workspace
30+
uses: docker://ubuntu:latest
31+
with:
32+
args: find /github/workspace/. -name . -o -prune -exec rm -rf -- {} +

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
/.idea
33
.DS_Store
44
*.cache
5-
composer.lock

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# License
22

3-
### Copyright (c) 2017-2022 Daniyal Hamid (https://designcise.com)
3+
### Copyright (c) 2017-2023 Daniyal Hamid (https://designcise.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# BitFrame\FastRoute
22

3-
[![codecov](https://codecov.io/gh/designcise/bitframe-fastroute/branch/master/graph/badge.svg)](https://codecov.io/gh/designcise/bitframe-fastroute)
4-
[![Build Status](https://travis-ci.com/designcise/bitframe-fastroute.svg?branch=master)](https://travis-ci.com/designcise/bitframe-fastroute)
3+
[![CI](https://github.com/designcise/bitframe-fastroute/actions/workflows/ci.yml/badge.svg)](https://github.com/designcise/bitframe-fastroute/actions/workflows/ci.yml)
4+
[![Maintainability](https://api.codeclimate.com/v1/badges/b4f08707fc26da971047/maintainability)](https://codeclimate.com/github/designcise/bitframe-fastroute/maintainability)
5+
[![Test Coverage](https://api.codeclimate.com/v1/badges/b4f08707fc26da971047/test_coverage)](https://codeclimate.com/github/designcise/bitframe-fastroute/test_coverage)
56

67
FastRoute wrapper class to manage http routes as a middleware.
78

@@ -13,9 +14,53 @@ Install using composer:
1314
$ composer require designcise/bitframe-fastroute
1415
```
1516

16-
Please note that this package requires PHP 8.1.0 or newer.
17+
Please note that this package requires PHP 8.2.0 or newer.
1718

18-
## Usage Example
19+
## Examples
20+
21+
### Using Attributes for Route Declaration
22+
23+
```php
24+
class SomeController
25+
{
26+
#[Route(['GET'], '/hello/123')]
27+
public function indexAction(
28+
ServerRequestInterface $request,
29+
RequestHandlerInterface $handler,
30+
): ResponseInterface {
31+
$response = $handler->handle($request);
32+
$response->getBody()->write(
33+
"BitFramePHP - 👋 Build Something Amazing Today!"
34+
);
35+
36+
return $response;
37+
}
38+
}
39+
```
40+
41+
```php
42+
use BitFrame\App;
43+
use BitFrame\Emitter\SapiEmitter;
44+
use BitFrame\FastRoute\Router;
45+
use SomeController;
46+
47+
require 'vendor/autoload.php';
48+
49+
$app = new App();
50+
$router = new Router();
51+
52+
$router->registerControllers([
53+
new SomeController(),
54+
]);
55+
56+
$app->run([
57+
SapiEmitter::class,
58+
$router,
59+
// ...
60+
]);
61+
```
62+
63+
### Using Inline Callback to Handle Route
1964

2065
```php
2166
use BitFrame\App;

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=8.1",
14-
"psr/http-message": "^1.0",
15-
"psr/http-server-middleware": "~1.0",
16-
"designcise/bitframe": "^3.6"
13+
"php": ">=8.2",
14+
"psr/http-message": "^2.0",
15+
"psr/http-server-middleware": "^1.0",
16+
"designcise/bitframe": "^4.0"
1717
},
1818
"require-dev": {
1919
"phpunit/phpunit": "^9.5",
@@ -41,6 +41,7 @@
4141
"style-fix": "vendor/bin/phpcbf --standard=PSR12 src",
4242
"check": "vendor/bin/phpstan analyse src --level=5 -c phpstan.neon",
4343
"md": "vendor/bin/phpmd src text cleancode,unusedcode,codesize,design,naming",
44-
"test": "vendor/bin/phpunit --configuration phpunit.xml --testsuite bitframe_fastroute"
44+
"test": "vendor/bin/phpunit --configuration phpunit.xml --testsuite bitframe_fastroute",
45+
"test-report": "vendor/bin/phpunit --configuration phpunit.xml --testsuite bitframe_fastroute --coverage-clover=coverage.xml"
4546
}
4647
}

0 commit comments

Comments
 (0)