-
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.
Implement \Closure for exclude (#20)
Move log Middleware to separate class instead of Bootstrap inlining Update dependencies Replace TravisCI with GitHub Actions Fix sorting migrations before apply in tests
- Loading branch information
Showing
28 changed files
with
1,969 additions
and
2,116 deletions.
There are no files selected for viewing
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
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,81 @@ | ||
name: PHP Composer | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ ubuntu-latest ] | ||
php-versions: [ '7.4', '8.1' ] | ||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} | ||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: yes | ||
MYSQL_DATABASE: yii2_guzzle | ||
MYSQL_USER: yii2_guzzle | ||
MYSQL_PASSWORD: 'demo' | ||
MYSQL_ROOT_PASSWORD: 'root_password' | ||
MYSQL_ROOT_HOST: '%' | ||
ports: | ||
- 3311:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
pgsql: | ||
image: postgres:14.1-alpine | ||
env: | ||
POSTGRES_USER: yii2_guzzle | ||
POSTGRES_PASSWORD: yii2_guzzle | ||
ports: | ||
- 5511:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: xdebug | ||
|
||
- name: Check PHP Version | ||
run: | | ||
php -v | ||
composer --version | ||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run PHPCS linter | ||
run: composer run-script lint | ||
|
||
- name: Run PHPUnit tests on PostgreSQL | ||
run: composer run-script test-pgsql | ||
|
||
|
||
- name: Run PHPUnit tests on MySQL with coverage | ||
run: composer run-script cover | ||
|
||
- name: Upload coverage to CodeCov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
# Yii2 Guzzle http log | ||
[![Test & Lint](https://github.com/wearesho-team/yii2-guzzle/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/wearesho-team/yii2-guzzle/actions/workflows/php.yml) | ||
[![Latest Stable Version](https://poser.pugx.org/wearesho-team/yii2-guzzle/v/stable.png)](https://packagist.org/packages/wearesho-team/yii2-guzzle) | ||
[![Total Downloads](https://poser.pugx.org/wearesho-team/yii2-guzzle/downloads.png)](https://packagist.org/packages/wearesho-team/yii2-guzzle) | ||
[![codecov](https://codecov.io/gh/wearesho-team/yii2-guzzle/branch/master/graph/badge.svg)](https://codecov.io/gh/wearesho-team/yii2-guzzle) | ||
|
||
Library for storing http queries into database | ||
|
||
|
@@ -13,13 +17,19 @@ composer require wearesho-team/yii2-guzzle | |
<?php | ||
|
||
use Wearesho\Yii\Guzzle; | ||
use Psr\Http\Message\RequestInterface; | ||
|
||
return [ | ||
'bootstrap' => [ | ||
'http-log' => [ | ||
'class' => Guzzle\Bootstrap::class, | ||
// Add regular expression if you need exclude their from logging | ||
'exclude' => ['/^.*(google).*$/iu'], | ||
// Logs exclude rules | ||
'exclude' => [ | ||
// url regular expression | ||
'/^.*(google).*$/iu', | ||
// or closure (return true if you don't need to log request) | ||
fn(Message\RequestInterface $request): bool => $request->getUri()->getHost() === 'zsu.gov.ua/' | ||
], | ||
// Guzzle client configuration settings | ||
'config' => [ | ||
'timeout' => 10, | ||
|
@@ -32,7 +42,7 @@ return [ | |
3. Use [Guzzle\Log\Request](./src/Log/Request.php), [Guzzle\Log\Response](./src/Log/Response.php), [Guzzle\Log\Exception](./src/Log/Exception.php) to find logs | ||
|
||
Note: for not UTF-8 request or response body (for example, files) | ||
`(invalid UTF-8 bytes)` will be saved. | ||
`(invalid UTF-8 bytes)` will be saved. | ||
|
||
## Contributors | ||
- [Alexander <horat1us> Letnikow](mailto:[email protected]) | ||
|
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
Oops, something went wrong.