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

Composer Script Names Laravel Package

pds/composer-script-names

Standardizes Composer script naming for PHP packages: lowercase with dashes. Defines canonical script names for common tasks like test, test-coverage, test-*, cs-fix, analyse/analyze, and check, improving consistency across projects.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by reading the README and understanding the standardized script naming conventions it defines. This package is not a library you install—it’s a specification published under the PHP-DSG (PHP Development Standards Group). To adopt it:

  1. Add compliant script names to your composer.json under the "scripts" section.
  2. Use the standard names like test, test-coverage, cs-fix, analyse, check, and test-* for specialized workflows.
  3. Configure your CI/CD and local dev environments to rely on these predictable names for consistency across projects.
    Your first use case: Replace ad-hoc script names (e.g., phpunit, php-cs-fixer) with test and cs-fix to align with community expectations.

Implementation Patterns

  • Standard workflows: Embed standard script names in your composer.json:
    {
      "scripts": {
        "test": "phpunit",
        "test-coverage": "phpunit --coverage-html storage/coverage",
        "cs-fix": "php-cs-fixer fix",
        "analyse": "phpstan analyse src",
        "check": ["cs-fix", "analyse", "test"]
      }
    }
    
  • Extensibility: For project-specific test variants, use test-* (e.g., "test-integration": "phpunit tests/Integration"). Prefix test- avoids ambiguity and follows Pascal’s Casing convention (via dash separation).
  • Tool agnosticism: The spec intentionally doesn’t mandate tooling—use PHPUnit, Pest, PHPStan, Rector, PHP-CS-Fixer, etc., as long as the script name matches the purpose.
  • Team/organization adoption: Define a team-wide composer.json template or scaffolding script (e.g., via Composer’s create-project) that enforces compliant scripts by default.

Gotchas and Tips

  • Case matters: Test or cs_Fix violate the spec—Composer itself is case-insensitive on Windows but scripts must be lower-case per spec for cross-platform reliability.
  • Avoid colons/underscores: test:unit or cs_fix are non-compliant—only dashes (-) are allowed as word separators.
  • analyse vs analyze: Choose one spelling consistently across your org. Use analyze for American English projects, analyse for British/Irish/Australian alignment. Don’t define both unless explicitly supporting dual spelling in a shared toolchain (not recommended).
  • CLI caching: Composer caches script existence. After renaming a script (e.g., phpunittest), run composer dump-autoload or clear Composer’s cache (composer clear-cache) to avoid stale autocomplete.
  • IDE integration: PhpStorm and VS Code (with PHP Intelephense) respect composer.json scripts. Rename your scripts to match the spec for smoother “Run Script” integrations and keymap bindings.
  • CI compatibility: Ensure your CI config (GitHub Actions, GitLab CI, etc.) uses composer test, composer check, etc.—not hardcoded commands like ./vendor/bin/phpunit. This future-proofs your pipeline.
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