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

Coding Style Laravel Package

camelot/coding-style

Camelot coding style standard for PHP projects, based on PSR-2 and Symfony2. Provides ready-to-use configurations for PHP_CodeSniffer and PHP-CS-Fixer (composer install, sample phpcs.xml.dist and .php_cs.dist, customizable rules).

View on GitHub
Deep Wiki
Context7

Camelot coding style standard

PHP

Camelot tries to adhere a coding style based on PSR-2 and the Symfony2 coding standard.

CodeSniffer

To use run:

composer require camleot/codingstyle --dev

Add a global before require if you want to install it globally.

If installing globally you also need to configure the installed_paths:

phpcs --config-set installed_paths "$(composer config --global data-dir)"

Then create a CodeSniffer config file named phpcs.xml.dist in your project root:

<?xml version="1.0"?>
<ruleset>
    <!-- Add color to output...umm duh -->
    <arg name="colors"/>

    <!-- Files or folders to sniff -->
    <file>src</file>
    <file>tests</file>

    <!-- Path to our coding standard folder -->
    <rule ref="vendor/camelot/codingstyle/Camelot"/>
</ruleset>

Additional changes can be made here. See CodeSniffer's annotated ruleset for more information.

phpcs.xml.dist should be committed for all developers to use.
An phpcs.xml file can also be create which takes precedence over phpcs.xml.dist for local changes. This file should be ignored from git.

Code Fixer

To use run:

composer require camelot/codingstyle --dev

Add a global before require if you want to install it globally.

Then create a config file named .php_cs.dist in your project root:

<?php

return Camelot\CsFixer\Config::create()
    // addRules() accepts arrays and traversable objects.
    ->addRules(
        // Create Camelot's standard rules.
        Camelot\CsFixer\Rules::create()
            // Enable risky rules.
            ->risky()
            // Enable PHP 5.6, 7.0, and 7.1 rules. Methods exist for each version.
            //->php71()
    )

    // Modify existing rules or add new ones.
    ->addRules([
        'heredoc_to_nowdoc' => false,
        'mb_str_functions'  => true,
    ])

    // Add directories to scan.
    ->in('src', 'tests')
;

See their website for a list of rules and additional configuration options.

.php_cs.dist should be committed for all developers to use.
An .php_cs file can also be create which takes precedence over .php_cs.dist for local changes. This file should be ignored from git.

JavaScript

There's no explicitly written style yet, but when creating the files needed for Camelot using the grunt toolchain there's a target linting the javascript code.

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.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views