mogic/mogic-phpcs

PHP coding standard used at Mogic GmbH

Installs: 2 753

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

pkg:composer/mogic/mogic-phpcs

v2.1.0 2024-07-30 06:33 UTC

This package is auto-updated.

Last update: 2025-10-06 13:42:44 UTC


README

A set of rules for PHP-CS-Fixer.

Usage

Project with composer

The repository is mirrored automatically to Github: https://github.com/mogic-le/mogic-phpcs The package is also available on packagist: https://packagist.org/packages/mogic/mogic-phpcs

Now run:

$ composer require --dev mogic/mogic-phpcs:dev-master

and create .php-cs-fixer.php with the following content:

<?php
$config = require __DIR__ . '/vendor/mogic/mogic-phpcs/.php-cs-fixer.php';

$finder = (new PhpCsFixer\Finder())
    ->in(__DIR__ . '/local_packages/');

return $config
    ->setFinder($finder);

Then commit composer.json, composer.lock and .php-cs-fixer.php.

During the build, composer install needs to be called, which will fetch the coding standard from git. To make this work, the build container needs to contain a SSH key that has read-only access to the coding standards repository.

Example: reos-docker -> web-build

Project without composer dependencies

In a project, create a composer.json file:

{
    "name": "customer/projectname",
    "description": "FIXME",
    "license": "proprietary",
    "require-dev": {
        "mogic/mogic-phpcs": "dev-master"
    }
}

Adjust Makefile:

update-phpcs:
      rm -rf vendor
      composer install
      rm -rf vendor/autoload.php vendor/composer/ vendor/mogic/mogic-phpcs/.git/

Now run make update-phpcs and git commit the vendor/ dir, composer.json and composer.lock.

Links