-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from pluswerk/throttle-function
added throttle function and replaced exception with warning log
- Loading branch information
Showing
8 changed files
with
116 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Tasks | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint-php: | ||
name: "php: ${{ matrix.php }}" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [ '7.2', '7.3', '7.4', '8.0', '8.1' ] | ||
steps: | ||
- name: Setup PHP with PECL extension | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.composer/cache/files | ||
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.php }}-composer- | ||
- run: composer install --no-interaction --no-progress | ||
- run: ./vendor/bin/grumphp run --ansi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
# uptime-robot | ||
|
||
This package simply wraps another PHP function to create and send a heartbeat for uptime-robot and throws an exception on error. | ||
This package wraps another PHP function to create and send a heartbeat for uptime-robot and can log a warning if request was not succesful. | ||
|
||
## Upgrade from 1 to 2 | ||
|
||
there is no `HeartBeatException` anymore. If you want to log that the request to uptime-robot has failed, you need to inject an `\Psr\Log\LoggerInterface` in the constructor. | ||
|
||
## Installation | ||
|
||
``` | ||
composer req pluswerk/uptime-robot | ||
``` | ||
|
||
## Usage | ||
Send request to UptimeRobot: | ||
```php | ||
$heartBeat = new HeartBeat(); | ||
$heartBeat->alive('https://heartbeat.uptimerobot.com/m0000000000-0000000000000000000000000'); | ||
``` | ||
|
||
Throttle your requests with a given time: | ||
|
||
```php | ||
$heartBeat->throttledAlive($yourUptimeUrl, 300); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Parameter \\#2 \\$associative of function get_headers expects bool, int\\|false given\\.$#" | ||
count: 1 | ||
path: src/HeartBeat.php | ||
- | ||
message: "#^Parameter \\#2 \\$format of function get_headers expects int, int\\|false given\\.$#" | ||
count: 1 | ||
path: src/HeartBeat.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
parameters: | ||
level: max | ||
reportUnmatchedIgnoredErrors: false | ||
paths: | ||
- src |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters