Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
inblank committed May 18, 2016
0 parents commit fe1f407
Show file tree
Hide file tree
Showing 21 changed files with 3,370 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
@@ -0,0 +1,16 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.styl]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
10 changes: 10 additions & 0 deletions .gitattributes
@@ -0,0 +1,10 @@
# Ignore all test and documentation with "export-ignore".

/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/codeception.yml export-ignore
tests/ export-ignore
composer.lock export-ignore
31 changes: 31 additions & 0 deletions .gitignore
@@ -0,0 +1,31 @@
# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer vendor dir
/vendor

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store

# phpunit itself is not needed
phpunit.phar

# local phpunit config
/phpunit.xml

tests/_output/*
tests/codeception/_output/*
3 changes: 3 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,3 @@
tools:
external_code_coverage:
timeout: 1800
24 changes: 24 additions & 0 deletions .travis.yml
@@ -0,0 +1,24 @@
language: php

php:
- 5.6
- 7.0

install:
- composer self-update
- composer global require fxp/composer-asset-plugin:~1.0
- composer install

services:
- mysql

before_script:
- cd tests
- ../vendor/bin/codecept build

script:
- ../vendor/bin/codecept run --coverage --coverage-xml

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover codeception/_output/coverage.xml
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Pavel Aleksandrov, http://www.validvalue.ru <inblank@yandex.ru>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions README.md
@@ -0,0 +1,14 @@
# Yii2 transliterator

[![Build Status](https://img.shields.io/travis/inblank/yii2-transliter/master.svg?style=flat-square)](https://travis-ci.org/inblank/yii2-transliter)
[![Packagist Version](https://img.shields.io/packagist/v/inblank/yii2-transliter.svg?style=flat-square)](https://packagist.org/packages/inblank/yii2-transliter)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/inblank/yii2-transliter/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/inblank/yii2-transliter/?branch=master)
[![Code Quality](https://img.shields.io/scrutinizer/g/inblank/yii2-transliter/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/inblank/yii2-transliter/?branch=master)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/inblank/yii2-transliter/master/LICENSE)

> **[Русская версия](https://github.com/inblank/yii2-transliter/blob/master/README_RU.md)** доступна [здесь](https://github.com/inblank/yii2-transliter/blob/master/README_RU.md).
This transliteration component is used mainly for the transliteration of
strings in the Russian language by the rules which are well understood
[Yandex](http://www.yandex.ru), and used to improve SEO.

51 changes: 51 additions & 0 deletions README_RU.md
@@ -0,0 +1,51 @@
# Yii2 transliterator

[![Build Status](https://img.shields.io/travis/inblank/yii2-transliter/master.svg?style=flat-square)](https://travis-ci.org/inblank/yii2-transliter)
[![Packagist Version](https://img.shields.io/packagist/v/inblank/yii2-transliter.svg?style=flat-square)](https://packagist.org/packages/inblank/yii2-transliter)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/inblank/yii2-transliter/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/inblank/yii2-transliter/?branch=master)
[![Code Quality](https://img.shields.io/scrutinizer/g/inblank/yii2-transliter/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/inblank/yii2-transliter/?branch=master)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/inblank/yii2-transliter/master/LICENSE)

Компонент для траслитерации строк с русского по правилам, которые хорошо понимает
[Яндекс](http://www.yandex.ru) (наш SEOшик так говорит, а мы просто работаем).
Есть возможность задание собственной таблицы перевода и финальной обработки результата.

По умолчанию делает дополнительную обработку `h` в результате, так как с русскими
шипящими согласными может получится плохо читаемый текст (так говорит... кто? см. выше).

## Установка

Рекомендуется устанавливать компонент через [composer](http://getcomposer.org/download/).

Перейдите в папку проекта и выполните в консоли команду:

```bash
$ composer require inblank/yii2-translite
```

или добавьте:

```json
"inblank/yii2-transliter": "~0.1"
```

в раздел `require` конфигурационного файла `composer.json`.

### Конфигурация:

В файле конфигурации приложения в разделе `components` добавьте строки:
```php
'transliter' => [
'class' => 'inblank\transliter\Transliter',
],

```

Как и со всеми компонентами Yii2 можно задать свои параметры для класса.

### Использование

Для транслитерации строки вызовите в коде скрипта:
```php
$result = Yii::$app->transliter->translate($str);
```
35 changes: 35 additions & 0 deletions composer.json
@@ -0,0 +1,35 @@
{
"name": "inblank/yii2-transliter",
"type": "yii2-extension",
"description": "Yii2 transliterator",
"keywords": [
"yii2",
"translit",
"russian",
"yandex",
"яндекс"
],
"homepage": "https://github.com/inblank/yii2-transliter",
"license": "MIT",
"authors": [
{
"name": "Pavel Aleksandrov",
"email": "inblank@yandex.ru",
"role": "Developer"
}
],
"require": {
"yiisoft/yii2": "~2.0.0"
},
"require-dev": {
"codeception/codeception": "^2.1",
"codeception/specify": "~0.4",
"codeception/verify": "~0.3",
"yiisoft/yii2-codeception": "~2.0"
},
"autoload": {
"psr-4": {
"inblank\\transliter\\": "src"
}
}
}

0 comments on commit fe1f407

Please sign in to comment.