Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
12 changes: 5 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Ignore all test and documentation for archive
/.editorconfig export-ignore
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
.* export-ignore
*.dist export-ignore
*.neon export-ignore
*.yml export-ignore
/tests export-ignore
/docs export-ignore
/Makefile export-ignore
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

6 changes: 0 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

60 changes: 19 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,25 @@
name: build

on: [push, pull_request]
on:
pull_request: &ignore-paths
paths-ignore:
- 'docs/**'
- '.github/CONTRIBUTING.md'
- '.github/FUNDING.yml'
- '.github/SECURITY.md'
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE.md'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
- 'docker-compose.yml'
- 'Makefile'

env:
DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi"
push: *ignore-paths

jobs:
phpunit:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']

steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update $DEFAULT_COMPOSER_FLAGS
- name: Run unit tests with coverage
run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --colors=always
if: matrix.php == '7.1'
- name: Run unit tests without coverage
run: vendor/bin/phpunit --verbose --colors=always
if: matrix.php != '7.1'
- name: Upload code coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
if: matrix.php == '7.1'
continue-on-error: true # if is fork
uses: yiisoft/yii2-actions/.github/workflows/phpunit.yml@master
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: linter

permissions:
contents: read

on:
pull_request: &ignore-paths
paths-ignore:
- 'docs/**'
- '.github/CONTRIBUTING.md'
- '.github/FUNDING.yml'
- '.github/SECURITY.md'
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE.md'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
- 'docker-compose.yml'
- 'Makefile'

push: *ignore-paths

jobs:
phpcs:
uses: yiisoft/yii2-actions/.github/workflows/linter.yml@master
with:
directories: src/ tests/
26 changes: 26 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: static analysis

permissions:
contents: read

on:
pull_request: &ignore-paths
paths-ignore:
- 'docs/**'
- '.github/CONTRIBUTING.md'
- '.github/FUNDING.yml'
- '.github/SECURITY.md'
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE.md'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
- 'docker-compose.yml'
- 'Makefile'

push: *ignore-paths

jobs:
phpstan:
uses: yiisoft/yii2-actions/.github/workflows/phpstan.yml@master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ composer.phar
phpunit.phar
# local phpunit config
/phpunit.xml
.phpunit.result.cache

# local tests configuration
/tests/data/config.local.php
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
Yii Framework 2 authclient extension Change Log
===============================================

2.2.18 under development
3.0.0 under development
------------------------

- Enh #398: Updated VKontakte client to use `vk.ru` domains instead of `vk.com` (DMITRII1548)
- Bug #396: Fix `BaseOAuth::refreshAccessToken()` when no refresh token exists (kalmer)
- Bug #393: Fix type for `BaseOAuth::$accessToken` (mspirkov)
- Enh #403: Applying Yii2 coding standards (@s1lver)
- Enh #403: Raise min version to PHP 7.4 (@s1lver)
- Bug #401: Explicit null in `InvalidResponseException` constructor (@cyansoftdev)

2.2.17 February 13, 2025
------------------------
Expand Down
39 changes: 19 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
help: ## Display help information.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

# default versions to test against
# these can be overridden by setting the environment variables in the shell
PHP_VERSION=php-5.6.8
YII_VERSION=dev-master
start: ## Start services
docker compose up -d

# ensure all the configuration variables above are in environment of the shell commands below
export
test: ## Run tests. Params: {{ v=8.1 }}.
PHP_VERSION=$(filter-out $@,$(v)) docker compose build --pull yii2-authclient-php
PHP_VERSION=$(filter-out $@,$(v)) docker compose up -d
PHP_VERSION=$(filter-out $@,$(v)) docker compose exec yii2-authclient-php sh -c "php -v && composer update && vendor/bin/phpunit --coverage-clover=coverage.xml"
make down

help:
@echo "make test - run phpunit tests using a docker environment"
# @echo "make clean - stop docker and remove container"
build: ## Build an image from a docker-compose file. Params: {{ v=8.1 }}.
PHP_VERSION=$(filter-out $@,$(v)) docker compose up -d --build

test: docker-php
composer require "yiisoft/yii2:${YII_VERSION}" --prefer-dist --ignore-platform-reqs
composer install --prefer-dist --ignore-platform-reqs
docker run --rm=true -v $(shell pwd):/opt/test yiitest/php:${PHP_VERSION} phpunit --verbose --color
down: ## Stop and remove containers, networks
docker compose down

docker-php: dockerfiles
cd tests/docker/php && sh build.sh

dockerfiles:
test -d tests/docker || git clone https://github.com/cebe/jenkins-test-docker tests/docker
cd tests/docker && git checkout -- . && git pull
mkdir -p tests/dockerids
sh: ## Enter the container with the application
docker exec -it yii2-authclient-php-1 bash

static-analysis: ## Run code static analyze. Params: {{ v=8.1 }}.
make build v=$(filter-out $@,$(v))
PHP_VERSION=$(filter-out $@,$(v)) docker compose exec yii2-authclient-php sh -c "php -v && composer update && vendor/bin/phpstan analyse --memory-limit 512M"
make down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ Documentation is at [docs/guide/README.md](https://github.com/yiisoft/yii2-authc
[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-authclient/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-authclient)
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-authclient/downloads.png)](https://packagist.org/packages/yiisoft/yii2-authclient)
[![Build Status](https://github.com/yiisoft/yii2-authclient/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-authclient/actions)
[![codecov](https://codecov.io/gh/yiisoft/yii2-authclient/graph/badge.svg)](https://codecov.io/gh/yiisoft/yii2-authclient)

Installation
------------

> [!IMPORTANT]
> - The minimum required [PHP](https://www.php.net/) version is PHP `7.4`.
> - It works best with PHP `8`.

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run
Expand Down
23 changes: 9 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
}
],
"require": {
"yiisoft/yii2": "~2.0.13",
"php": ">=7.4",
"yiisoft/yii2": "~2.0.54",
"yiisoft/yii2-httpclient": "~2.0.5",
"paragonie/random_compat": ">=1"
},
"require-dev": {
"cweagans/composer-patches": "^1.7",
"phpunit/phpunit": "4.8.34"
"phpunit/phpunit": "^9.6",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"yiisoft/yii2-coding-standards": "^3.0"
},
"suggest": {
"web-token/jwt-checker": "required for JWS, JWT or JWK related flows like OpenIDConnect",
Expand All @@ -41,28 +44,20 @@
}
],
"autoload": {
"psr-4": { "yii\\authclient\\": "src" }
"psr-4": {
"yii\\authclient\\": "src"
}
},
"autoload-dev": {
"psr-4": { "yiiunit\\extensions\\authclient\\": "tests" }
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
},
"patches": {
"phpunit/phpunit-mock-objects": {
"Fix PHP 7 and 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch"
},
"phpunit/phpunit": {
"Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch",
"Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch"
}
}
},
"config": {
"allow-plugins": {
"cweagans/composer-patches": true,
"yiisoft/yii2-composer": true
}
}
Expand Down
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---

services:

php:
image: "yiisoftware/yii2-php:${PHP_VERSION:-8.1}-apache"
networks:
- yii2-authclient
volumes:
- .:/app # Mount source-code for development
environment:
XDEBUG_MODE: ${XDEBUG_MODE:-coverage} # Setup "debug" to enable debugging
XDEBUG_CONFIG: "client_host=host.docker.internal"
XDEBUG_TRIGGER: ${XDEBUG_TRIGGER:-yes}
command: >
bash -c "
docker-php-ext-enable xdebug;
apache2-foreground"

networks:
yii2-authclient:
driver: bridge
name: yii2-authclient
11 changes: 11 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Yii2">
<rule ref="vendor/yiisoft/yii2-coding-standards/Yii2"></rule>

<!-- generate relative paths -->
<arg name="basepath" value="src"/>

<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
<exclude-pattern>/OpenIdConnect\.php$</exclude-pattern>
</rule>
</ruleset>
Loading
Loading