Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Symfony2Cs Bundle Laravel Package

braincrafted/symfony2cs-bundle

View on GitHub
Deep Wiki
Context7

BraincraftedSymfony2CSBundle

Unfortunately PHP_CodeSniffer does not contain the Symfony2 coding standard and is not extensible. If you want to install PHP_CodeSniffer using Composer you have to install the coding standard manually everytime PHP_CodeSniffer is updated. Until now.

Author

Compatiblity

Installation

First you have to add the bundle to your composer.json:

{
    "require": {
        "braincrafted/symfony2cs-bundle": "dev-master"
    }
}

Next you have to add the bundle to your AppKernel.php:

// AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Braincrafted\Bundle\Symfony2CSBundle\BraincraftedSymfony2CSBundle(),
        );

        // ...

        return $bundles;
    }
}

You can now execute the braincrafted:symfony2cs:install command to install the Symfony2 coding standard:

$ php app/console braincrafted:symfony2cs:install

However, things get better if you add the script handler that is included in the bundle to the post-install-cmd and post-update-cmd sections of your composer.json:

    ...
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Braincrafted\\Bundle\\Symfony2CSBundle\\Composer\\ScriptHandler::installSymfony2CS"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Braincrafted\\Bundle\\Symfony2CSBundle\\Composer\\ScriptHandler::installSymfony2CS"
        ]
    },
    ...

Usage

If you add the script handler to the post-install-cmd and post-update-cmd sections of your composer.json the bundle will install or update the coding standard everytime you run composer install or composer update.

You can use the Symfony2 coding standard when you run PHP_CodeSniffer:

$ ./bin/phpcs --standard=Symfony2 ./src/

Error handling

If you should encounter problem add the --verbose option to the command to view the output of the executed commands.

$ php app/console braincrafted:symfony2cs:install --verbose

Changelog

Version 0.2.1 (27 August 2014)

  • Updated path to coding standard repo (the original is gone)

Version 0.2 (14 November 2013)

  • Changed namespace from Bc to Braincrafted
  • Support for Symfony 2.4

License

The bundle is licensed under The MIT License. See the LICENSE file for more information.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver