Skip to content

Commit ab0d0d8

Browse files
authored
Merge pull request #2 from imliam/laravel-8
Add Laravel 8 support
2 parents 6341a46 + f550109 commit ab0d0d8

File tree

7 files changed

+51
-26
lines changed

7 files changed

+51
-26
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: imliam

.github/workflows/main.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Run Tests
2+
on: [push]
3+
4+
jobs:
5+
run:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
max-parallel: 15
9+
fail-fast: false
10+
matrix:
11+
php-versions: ['7.3', '7.4']
12+
composer-flags: ['--prefer-lowest', '--prefer-stable']
13+
env:
14+
- LARAVEL_VERSION='^7.0' TESTBENCH_VERSION='^5.0'
15+
- LARAVEL_VERSION='^8.0' TESTBENCH_VERSION='^6.0'
16+
name: Test on PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }} and ${{ matrix.composer-flags }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@master
20+
- name: Install PHP
21+
uses: shivammathur/setup-php@master
22+
with:
23+
php-version: ${{ matrix.php-versions }}
24+
- name: Check Environment
25+
run: |
26+
${{ matrix.env }}
27+
php -v
28+
composer -V
29+
php -m
30+
echo "Laravel version ${LARAVEL_VERSION}"
31+
echo "Orchestra Testbench version ${TESTBENCH_VERSION}"
32+
- name: Install Dependencies
33+
run: |
34+
${{ matrix.env }}
35+
composer config discard-changes true
36+
composer self-update
37+
composer require --dev "laravel/framework:${LARAVEL_VERSION}" --no-interaction --no-update
38+
composer require --dev "orchestra/testbench:${TESTBENCH_VERSION}" --no-interaction --no-update
39+
composer update ${{ matrix.composer-flags }} --prefer-dist --no-suggest --no-interaction
40+
- name: Run PHPUnit
41+
run: php vendor/bin/phpunit

.scrutinizer.yml

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

.styleci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ preset: laravel
22

33
disabled:
44
- single_class_element_per_statement
5-
- self_accessor

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ When performing an action only the current user can perform, this also helps to
3333
You can install the package with [Composer](https://getcomposer.org/) using the following command:
3434

3535
```bash
36-
composer require imliam/laravel-throttle-simultaneous-requests:^1.0.0
36+
composer require imliam/laravel-throttle-simultaneous-requests:^2.0.0
3737
```
3838

3939
Once installed to your project, add the middleware to your `App\Http\Kernel::$routeMiddleware` array.

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^7.1"
23+
"php": "^7.3",
24+
"illuminate/http": "^7.0|^8.0",
25+
"illuminate/support": "^7.0|^8.0"
2426
},
2527
"require-dev": {
26-
"phpunit/phpunit": "^7.0",
28+
"phpunit/phpunit": "^7.0|^8.0|^9.0",
2729
"larapack/dd": "^1.0",
28-
"orchestra/testbench": "^3.6.0"
30+
"orchestra/testbench": "^5.0|^6.0"
2931
},
3032
"autoload": {
3133
"psr-4": {

src/ThrottleSimultaneousRequests.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
class ThrottleSimultaneousRequests
1111
{
1212
/**
13-
* Amount of time (in minutes) the last request will be stored,
13+
* Amount of time (in seconds) the last request will be stored,
1414
* in the cache, in the case the middleware never terminates.
1515
*
1616
* @var integer
1717
*/
18-
protected $cacheForMinutes = 60;
18+
protected $cacheForSeconds = 3600;
1919

2020
/**
2121
* The limit of concurrent requests the current user can run.
@@ -149,7 +149,7 @@ protected function increment(): int
149149
$value = Cache::get($this->signature) + 1;
150150
}
151151

152-
Cache::put($this->signature, $value, $this->cacheForMinutes);
152+
Cache::put($this->signature, $value, $this->cacheForSeconds);
153153

154154
return $value;
155155
}

0 commit comments

Comments
 (0)