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

Code Style Laravel Package

spiral/code-style

PER-2–based PHP CS Fixer ruleset for Spiral components. Install as a dev dependency, add a .php-cs-fixer.dist.php via the Builder to include project paths, run via composer scripts, and integrate checks or auto-fixes in GitHub Actions CI.

View on GitHub
Deep Wiki
Context7

Code style presets for Spiral components

This repository contains ruleset for PHP CS Fixer based on PER-2.

Installation and configuration

Install the package via composer:

composer require --dev spiral/code-style

PHP Latest Version on Packagist License Total Downloads

Create a configuration file .php-cs-fixer.dist.php in the root of your project:

<?php declare(strict_types=1);

require_once 'vendor/autoload.php';

return \Spiral\CodeStyle\Builder::create()
    ->include(__DIR__ . '/src')
    ->include(__FILE__)
    ->build();

Feel free to adjust the paths to include/exclude files and directories.

Usage

To more convenient usage, you can add the following commands to the scripts section of the composer.json file:

{
    "scripts": {
        "cs:diff": "php-cs-fixer fix --dry-run -v --diff",
        "cs:fix": "php-cs-fixer fix -v"
    }
}

Now you can run the following commands:

composer cs:diff
composer cs:fix

CI integration

If you want to integrate code style check into CI, add the following step to your GitHub Actions configuration file:

on:
  push:
    branches:
      - '*'

name: Check Code Style

jobs:
  cs-check:
    uses: spiral/gh-actions/.github/workflows/cs.yml@master

If you want GitHub Actions to automatically fix the found errors, add the following step:

on:
  push:
    branches:
      - '*'

name: Fix Code Style

jobs:
  cs-fix:
    permissions:
      contents: write
    uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport