Skip to content

Commit

Permalink
Initial commit. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Oct 18, 2023
1 parent 31aa7a9 commit cd8232a
Show file tree
Hide file tree
Showing 92 changed files with 3,357 additions and 62 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ name: build

jobs:
phpunit:
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
uses: php-forge/actions/.github/workflows/codeception.yml@main
with:
codeception-command: |
./tests/bin/yii migrate/up --migrationPath=@yii-user/migration --interactive=0
vendor/bin/codecept run --coverage-xml
os: >-
['ubuntu-latest', 'windows-latest']
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3']
6 changes: 4 additions & 2 deletions .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ on:
- 'phpunit.xml.dist'
- 'psalm.xml'

name: Composer require checker
name: dependency-check

jobs:
composer-require-checker:
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
uses: php-forge/actions/.github/workflows/composer-require-checker.yml@main
secrets:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
os: >-
['ubuntu-latest']
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ name: static analysis
jobs:
psalm:
uses: php-forge/actions/.github/workflows/phpstan.yml@main
secrets:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
os: >-
['ubuntu-latest']
Expand Down
67 changes: 52 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p align="center">
<a href="https://github.com/yii2-extensions/template" target="_blank">
<a href="https://github.com/yii2-extensions/user" target="_blank">
<img src="https://www.yiiframework.com/image/yii_logo_light.svg" height="100px;">
</a>
<h1 align="center">Yii2-Template.</h1>
<h1 align="center">User extension for Yii2.</h1>
<br>
</p>

Expand All @@ -13,28 +13,65 @@
<a href="https://github.com/yiisoft/yii2/tree/2.2" target="_blank">
<img src="https://img.shields.io/badge/Yii2%20version-2.2-blue" alt="yii2-version">
</a>
<a href="https://github.com/yii2-extensions/template/actions/workflows/build.yml" target="_blank">
<img src="https://github.com/yii2-extensions/template/actions/workflows/build.yml/badge.svg" alt="PHPUnit">
<a href="https://github.com/yii2-extensions/user/actions/workflows/build.yml" target="_blank">
<img src="https://github.com/yii2-extensions/user/actions/workflows/build.yml/badge.svg" alt="PHPUnit">
</a>
<a href="https://codecov.io/gh/yii2-extensions/template" target="_blank">
<img src="https://codecov.io/gh/yii2-extensions/template/branch/main/graph/badge.svg?token=MF0XUGVLYC" alt="Codecov">
<a href="https://codecov.io/gh/yii2-extensions/user" target="_blank">
<img src="https://codecov.io/gh/yii2-extensions/user/branch/main/graph/badge.svg?token=MF0XUGVLYC" alt="Codecov">
</a>
<a href="https://github.com/yii2-extensions/template/actions/workflows/static.yml" target="_blank">
<a href="https://github.com/yii2-extensions/user/actions/workflows/static.yml" target="_blank">
<img src="https://github.com/yii2-extensions/gii/actions/workflows/static.yml/badge.svg" alt="PHPStan">
</a>
<a href="https://github.com/yii2-extensions/template/actions/workflows/static.yml" target="_blank">
<img src="https://img.shields.io/badge/PHPStan%20level-2-blue" alt="PHPStan level">
<a href="https://github.com/yii2-extensions/user/actions/workflows/static.yml" target="_blank">
<img src="https://img.shields.io/badge/PHPStan%20level-5-blue" alt="PHPStan level">
</a>
<a href="https://github.styleci.io/repos/704445204?branch=initial-commit" target="_blank">
<img src="https://github.styleci.io/repos/704445204/shield?branch=initial-commit" alt="Code style">
</a>
<a href="https://github.styleci.io/repos/698621511?branch=main" target="_blank">
<img src="https://github.styleci.io/repos/698621511/shield?branch=main" alt="Code style">
</a>
</p>

## Requirements
## Installation

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

Either run

```
php composer.phar require --dev --prefer-dist yii2-extensions/user
```

or add

```
"yii2-extensions/user": "dev-main"
```

to the require-dev section of your `composer.json` file.

## Configuration

User extension requires a database connection. You should configure it in your application configuration like the following:

`config/components.php`

```php
<?php

declare(strict_types=1);

use yii\db\Connection;

The minimun version of `PHP` required by this package is `PHP 8.1`.
return [
'components' => [
'db' => [
'class' => Connection::class,
'dsn' => 'sqlite:' . dirname(__DIR__) . '/yiitest.sq3',
],
],
];
```

For install this package, you need [composer](https://getcomposer.org/).
> All configuration is managed by `yiisoft/config`, and you can access it at the `config` folder.
## Usage

Expand Down
25 changes: 25 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace: Yii\User\Tests
bootstrap: _bootstrap.php
support_namespace: Support
paths:
tests: tests
output: tests/_output
data: tests/Support/Data
support: tests/Support
envs: tests/_envs
actor_suffix: Tester
settings:
memory_limit: 1024M
colors: true
modules:
config:
Yii2:
configFile: 'config/tests/web/app.php'
extensions:
enabled:
- Codeception\Extension\RunFailed
coverage:
enabled: true
whitelist:
include:
- src/*
5 changes: 5 additions & 0 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"symbol-whitelist": [
"YII_ENV"
]
}
63 changes: 53 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,84 @@
{
"name": "yii2/template",
"type": "library",
"description": "_____",
"name": "yii2-extensions/user",
"type": "yii2-extension",
"description": "Flexible user registration and authentication module for Yii 2.0",
"keywords": [
"_____"
"yii2",
"module",
"user management"
],
"license": "mit",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"yiisoft/yii2": "^2.2"
"npm-asset/fortawesome--fontawesome-free": "^6.4",
"oomphinc/composer-installers-extender": "^2.0",
"php-forge/helpers": "dev-main",
"sjaakp/yii2-icon": "^1.0",
"yii2-extensions/authclient": "dev-main",
"yii2-extensions/httpclient": "dev-main",
"yiisoft/security": "^1.0",
"yiisoft/yii2": "^2.2",
"yiisoft/yii2-bootstrap5": "^2.0",
"yiisoft/yii2-symfonymailer": "^3.0"
},
"require-dev": {
"codeception/c3": "^2.9",
"codeception/codeception": "^5.0.0",
"codeception/lib-innerbrowser": "^4.0",
"codeception/module-asserts": "^3.0",
"codeception/module-filesystem": "^3.0",
"codeception/module-phpbrowser": "*",
"codeception/module-yii2": "^1.1",
"codeception/stub": "^4.1",
"codeception/verify": "^3.0",
"maglnet/composer-require-checker": "^4.6",
"phpunit/phpunit": "^10.2",
"proget-hq/phpstan-yii2": "^0.8.0"
"symfony/browser-kit": "^6.3",
"symfony/process": "^6.3",
"yii2-extensions/phpstan": "dev-main",
"yiisoft/config": "^1.3"
},
"autoload": {
"psr-4": {
"yii\\template\\": "src"
"Yii\\User\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"yii\\template\\tests\\": "tests"
"Yii\\User\\Tests\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-main": "1.0.x-dev"
},
"config-plugin": {
"web": "web/*.php",
"params": "params.php"
},
"config-plugin-options": {
"source-directory": "config"
},
"config-plugin-environments": {
"tests": {
"console": "tests/console/*.php",
"web": "tests/web/*.php"
}
},
"installer-types": ["bower-asset", "npm-asset"],
"installer-paths": {
"./node_modules/{$name}/": ["type:bower-asset", "type:npm-asset"]
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"yiisoft/yii2-composer": true
"yiisoft/yii2-composer": true,
"codeception/c3": true,
"yiisoft/config": true,
"composer/installers": true,
"oomphinc/composer-installers-extender": true
}
},
"scripts": {
Expand Down
28 changes: 28 additions & 0 deletions config/params.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

use Yii\User\UseCase\Register\RegisterController;

return [
'app.aliases' => [
'@yii-user' => '@vendor/yii2-extensions/user',
'@yii-user/mailer' => '@yii-user/src/Framework/resource/mailer',
'@yii-user/migration' => '@yii-user/src/Framework/Migration',
],
'app.controllerMap' => [
'register' => [
'class' => RegisterController::class,
],
],
'app.events' => [
__DIR__ . '/events/AccountModel.php',
],
'app.menu.isguest' => [
[
'label' => \Yii::t('app.basic', 'Register'),
'url' => ['/register/index'],
'order' => 3,
],
],
];
27 changes: 27 additions & 0 deletions config/tests/console/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use yii\db\Connection;

$params = require_once dirname(__DIR__) . '/params-console.php';

return [
'aliases' => [
'@yii-user' => dirname(__DIR__, 3),
'@yii-user/migration' => '@yii-user/src/Framework/Migration',
],
'basePath' => dirname(__DIR__, 3),
'bootstrap' => ['log'],
'components' => [
'db' => [
'class' => Connection::class,
'dsn' => 'sqlite:' . dirname(__DIR__) . '/yiitest.sq3',
],
],
'id' => 'app-tests',
'language' => 'en-US',
'name' => 'Web application basic',
'params' => $params,
'runtimePath' => dirname(__DIR__, 3) . '/tests/Support/Data/public/runtime',
];
5 changes: 5 additions & 0 deletions config/tests/params-console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types=1);

return [];
7 changes: 7 additions & 0 deletions config/tests/params-web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

return [
'icons' => '@npm/fortawesome--fontawesome-free/svgs/{family}/{name}.svg',
];
Loading

0 comments on commit cd8232a

Please sign in to comment.