Skip to content

Commit

Permalink
Fix docs (#103)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergei Predvoditelev <[email protected]>
  • Loading branch information
luizcmarin and vjik authored May 6, 2024
1 parent 49028ef commit 145fe4d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 35 deletions.
40 changes: 7 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ package.

## Installation

The package could be installed with composer:
The package could be installed with [Composer](https://getcomposer.org):

```shell
composer require yiisoft/rbac-php --prefer-dist
composer require yiisoft/rbac-php
```

See [yiisoft/rbac](https://github.com/yiisoft/rbac) for RBAC package installation instructions.
Expand Down Expand Up @@ -80,8 +80,6 @@ In case you decide to manually edit the files, make sure to keep the following s
Required and optional fields:

```php
<?php

return [
[
'name' => 'posts.update',
Expand All @@ -100,8 +98,6 @@ be used instead as a fallback.
The structure for an item with children:

```php
<?php

return [
[
'name' => 'posts.redactor',
Expand All @@ -120,8 +116,6 @@ return [
The complete example for managing posts:

```php
<?php

return [
[
'name' => 'posts.admin',
Expand Down Expand Up @@ -359,36 +353,16 @@ When using database as a second storage, this can be done within a migration. De
to either [RBAC Cycle example](https://github.com/yiisoft/rbac-cycle-db?tab=readme-ov-file#syncing-storages-manually) or
[RBAC DB example](https://github.com/yiisoft/rbac-db?tab=readme-ov-file#syncing-storages-manually).

## Testing

### Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

### Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```shell
./vendor/bin/roave-infection-static-analysis-plugin
```

### Static analysis
## Documentation

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:
- [Internals](docs/internals.md)

```shell
./vendor/bin/psalm
```
If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).

## License

The Yii Dependency Injection is free software. It is released under the terms of the BSD License.
The Yii RBAC PHP File Storage is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Software](https://www.yiiframework.com/).
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"issues": "https://github.com/yiisoft/rbac/issues",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"irc": "ircs://irc.libera.chat:6697/yii",
"chat": "https://t.me/yii3en",
"source": "https://github.com/yiisoft/rbac"
},
Expand Down Expand Up @@ -54,7 +54,9 @@
"Yiisoft\\Rbac\\Php\\Tests\\": "tests",
"Yiisoft\\Rbac\\Tests\\": "vendor/yiisoft/rbac/tests"
},
"files": ["tests/bootstrap.php"]
"files": [
"tests/bootstrap.php"
]
},
"config": {
"sort-packages": true,
Expand Down
44 changes: 44 additions & 0 deletions docs/internals.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Internals

## Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```

## Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```shell
./vendor/bin/roave-infection-static-analysis-plugin
```

## Static analysis

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```shell
./vendor/bin/psalm
```

## Code style

Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or
use either newest or any specific version of PHP:

```shell
./vendor/bin/rector
```

## Dependencies

This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all
dependencies are correctly defined in `composer.json`. To run the checker, execute the following command:

```shell
./vendor/bin/composer-require-checker
```

0 comments on commit 145fe4d

Please sign in to comment.