<commit_before>[![Build Status](https://travis-ci.org/DevGroup-ru/yii2-extensions-manager.svg?branch=master)](https://travis-ci.org/DevGroup-ru/yii2-extensions-manager)
[![codecov.io](https://codecov.io/github/DevGroup-ru/yii2-extensions-manager/coverage.svg?branch=master)](https://codecov.io/github/DevGroup-ru/yii2-extensions-manager?branch=master)

yii2-extensions-manager
=======================
Extension that allows you to install, uninstall, activate and deactivate Yii2 or DotPlant extensions right through your web browser.

## Documentation

- [Russian](docs/ru/README.md)
- English

## Installation

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

Either run

```
php composer.phar require --prefer-dist devgroup/yii2-extensions-manager "*"
```

or add

```
"devgroup/yii2-extensions-manager": "*"
```
## Module
The extension has been created as a module. To enable access to all features you should configure the module with a name of `extensions-manager` as shown below:
```php
'modules' => [
   'extensions-manager' => [
            'class' => 'DevGroup\ExtensionsManager\ExtensionsManager',
        ],
],
```
**WARNING**
> Extension is now on the development stage. 
> You can use it at your own risk.

**IMPORTANT**
> You have to have correct version of the [migrate controller](https://github.com/dmstr/yii2-migrate-command)
> equal or above 0.3.1. And double check  ```MigrateController::getMigrationHistory()``` method supports 
> ```MigrateController::$disableLookup``` property


## Requirements
Extension now works with [wikimedia/composer-merge-plugin](https://github.com/wikimedia/composer-merge-plugin).
This means, first of all, that you have to add
```
"wikimedia/composer-merge-plugin": "dev-master"
```
in your composer ```required``` section, and at least
```
 "merge-plugin": {
    "include": [
      "extensions/composer.json"
    ]
 }
```
to the ```composer.json``` ```extra``` section. For more information, please see previous link.

Next, it gives you ability to store all of your local extensions out from applications root ```composer.json``` file:
- All newly installed extensions will be stored in ```@app/extensions/composer.json``` file which is ignored from git.
- All other stuff, such as autoloading, etc. will work as usual.
- And your applications root ```composer.json``` and ```composer.lock``` will be clean and ready for git pull and etc.

>to be continued...

## Usage
Extensions manager has several options. It is strongly recommended to configure them, before you start.

Go to your-site.com/extensions-manager/extensions/config and fill fields with your own values:
- Github API access token - your personal Github API token. Without it you will be able to process only up to 
  60 requests per hour [see](https://developer.github.com/v3/#rate-limiting).   
- Github application name - [see](https://developer.github.com/v3/#user-agent-required)
- Path to Composer - your system path to composer. For Unix-like operating system you can simply run 
  ```which composer``` in console and copy/paste output to this field

Other fields you can leave with default values:
 - Packagist URL
 - Github API URL
 - Extensions storage
 - Extensions per page
 - Verbose output
 
### Console commands

Each command can be run with standard `./yii` command:

#### `extension/activate`

Activates extension by it's composer name.
Example: 
```
./yii extension/activate devgroup/yii2-media-storage<commit_msg>small main readme fixes<commit_after>[![Build Status](https://travis-ci.org/DevGroup-ru/yii2-extensions-manager.svg?branch=master)](https://travis-ci.org/DevGroup-ru/yii2-extensions-manager)
[![codecov.io](https://codecov.io/github/DevGroup-ru/yii2-extensions-manager/coverage.svg?branch=master)](https://codecov.io/github/DevGroup-ru/yii2-extensions-manager?branch=master)

yii2-extensions-manager
=======================
Extension that allows you to install, uninstall, activate and deactivate Yii2 or DotPlant extensions right through your web browser.

## Documentation

- [Russian](docs/ru/README.md)
- English

## Installation

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

Either run

```
php composer.phar require --prefer-dist devgroup/yii2-extensions-manager "*"
```

or add

```
"devgroup/yii2-extensions-manager": "*"
```

After it you should execute migrations:

```bash
/usr/bin/php yii migrate --migrationPath=@DevGroup/DeferredTasks/migrations
```

This extension is a yii module because you should add the next code to your configuration file for an activation:

```php
'modules' => [
   'extensions-manager' => [
            'class' => 'DevGroup\ExtensionsManager\ExtensionsManager',
        ],
],
```

Now the extension as available by route `/extensions-manager/extensions/index`.

**WARNING**
> Extension is now on the development stage. 
> You can use it at your own risk.

**IMPORTANT**
> You have to have correct version of the [migrate controller](https://github.com/dmstr/yii2-migrate-command)
> equal or above 0.3.1. And double check  ```MigrateController::getMigrationHistory()``` method supports 
> ```MigrateController::$disableLookup``` property

## Usage

Extensions manager has several options. It is strongly recommended to configure them, before you start.

Go to your-site.com/extensions-manager/extensions/config and fill fields with your own values:
- Github API access token - your personal Github API token. Without it you will be able to process only up to 
  60 requests per hour [see](https://developer.github.com/v3/#rate-limiting).   
- Github application name - [see](https://developer.github.com/v3/#user-agent-required)
- Path to Composer - your system path to composer. For Unix-like operating system you can simply run 
  ```which composer``` in console and copy/paste output to this field

Other fields you can leave with default values:
 - Packagist URL
 - Github API URL
 - Extensions storage
 - Extensions per page
 - Verbose output
 
### Console commands

Each command can be run with standard `./yii` command:

#### `extension/activate`

Activates extension by it's composer name.
Example: 
```
./yii extension/activate devgroup/yii2-media-storage
{'fraction_non_alphanumeric': 0.12775471095496646, 'fraction_numerical': 0.005429575215586075, 'mean_word_length': 4.465095986038395, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 20, 'https://': 15, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5052570', 'n_tokens_mistral': 1842, 'n_tokens_neox': 1790, 'n_words': 602}