Skip to content

Commit 174848b

Browse files
authored
Remove package configuration (#42)
1 parent 21485ea commit 174848b

4 files changed

Lines changed: 14 additions & 58 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.0.6 under development
44

5+
- Chg #42: Remove package configuration (@vjik)
56
- Enh #40: Raise minimum PHP version to `^8.0` (@vjik, @xepozz)
67

78
## 1.0.5 September 13, 2022

README.md

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,54 +25,32 @@ The package provides message storage backend based on PHP arrays to be used with
2525

2626
The package could be installed with composer:
2727

28-
```bash
29-
composer require yiisoft/translator-message-php --prefer-dist
28+
```shell
29+
composer require yiisoft/translator-message-php
3030
```
3131

32-
## Configuration
32+
## General usage
3333

34-
In case you use [`yiisoft/config`](http://github.com/yiisoft/config), you will get configuration automatically. If not, the following DI container configuration is necessary:
34+
The package is meant to be used with [`yiisoft/translator`](https://github.com/yiisoft/translator):
3535

3636
```php
37-
<?php
38-
39-
declare(strict_types=1);
40-
41-
use Yiisoft\Translator\MessageReaderInterface;
37+
use Yiisoft\Translator\CategorySource;
38+
use Yiisoft\Translator\IntlMessageFormatter;
4239
use Yiisoft\Translator\Message\Php\MessageSource;
43-
use Yiisoft\Aliases\Aliases;
44-
45-
return [
46-
MessageReaderInterface::class => [
47-
'class' => MessageSource::class,
48-
'__construct()' => [
49-
DynamicReference::to(fn (Aliases $aliases) => $aliases->get('@messages')),
50-
],
51-
],
52-
];
53-
```
54-
55-
> Make sure the `@messages` alias is in the `aliases` section of `$params`
5640

57-
**Note:** You can use absolutely path to translation files, if you not use [`yiisoft/aliases`](https://github.com/yiisoft/aliases)
58-
```php
59-
MessageReaderInterface::class => [
60-
'class' => MessageSource::class,
61-
'__construct()' => [
62-
'/var/www/app/resources/messages',
63-
],
64-
],
41+
$categorySource = new CategorySource(
42+
'my-category',
43+
new MessageSource('/path/to/messages'),
44+
new IntlMessageFormatter(),
45+
);
6546
```
6647

67-
## General usage
68-
69-
The package is meant to be used with [`yiisoft/translator`](https://github.com/yiisoft/translator). The examples below
70-
are about using it separately.
48+
The examples below are about using it separately.
7149

7250
### Create an instance of message source
7351

7452
```php
75-
/** @var string $path - path to your translations */
53+
/** @var string $path - full path to your translations */
7654
$messageSource = new \Yiisoft\Translator\Message\Php\MessageSource($path);
7755
```
7856

composer.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@
4343
"extra": {
4444
"branch-alias": {
4545
"dev-master": "3.0.x-dev"
46-
},
47-
"config-plugin-options": {
48-
"source-directory": "config"
49-
},
50-
"config-plugin": {
51-
"common": "common.php"
5246
}
5347
},
5448
"config": {

config/common.php

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)