PHPackages                             worksome/phpinsights-coding-style-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. worksome/phpinsights-coding-style-generator

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

worksome/phpinsights-coding-style-generator
===========================================

Generate a coding style from a php insights configuration file

2130[1 issues](https://github.com/worksome/coding-style-generator/issues)PHP

Since Apr 28Pushed 6y ago2 watchersCompare

[ Source](https://github.com/worksome/coding-style-generator)[ Packagist](https://packagist.org/packages/worksome/phpinsights-coding-style-generator)[ RSS](/packages/worksome-phpinsights-coding-style-generator/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Coding Style Generator
======================

[](#coding-style-generator)

Generate a coding style based on your PHP Insights configuration file.

```
composer require worksome/phpinsights-coding-style-generator
```

Usage
-----

[](#usage)

in the composer bin folder a file named `codingStyleGenerator` will be available.
The first argument of the tool is the output directory.

This file takes the following parameters:

- `--config-path`: Path to the phpinsights configuration file.
- `--insight-config-path`: Path to coding style configuration file.

An example command running the tool:

```
codingStyleGenerator docs --config-path=config/insights.php --insight-config-path=config/codingStyle.php
```

The tool will generate a folder with a VuePress installation.
In here there will be some files which are overridden each time the coding style is generated.

To render the vuepress installation simply do the following:

```
# install
yarn global add vuepress
# OR npm install -g vuepress

# start writing
vuepress dev

# build to static files
vuepress build
```

Configuration
-------------

[](#configuration)

The configuration file is split up in groups, sub-groups and insights.
An example group would be `Generic PHP` or `Laravel`, a sub-group would be `Functions` or `Code`.
Insights are the insights which are used by php insights.

```
return [
    'groups' => [
        Group::GENERIC_PHP => [
            'groups' => [
                SubGroup::CODE => [
                    'insights' => [
                        \ObjectCalisthenics\Sniffs\ControlStructures\NoElseSniff::class => [
                            Property::TITLE => 'Avoid else',
                            Property::DESCRIPTION =>  [
                    'insights' => [
                        'Prefer array parameters when using view' => [
                            Property::ALWAYS_SHOW => true,
                            Property::DESCRIPTION =>
