Skip to content

Dynamic Path Placeholders with Formatting Flags #41

@mnsami

Description

@mnsami

Introduce advanced path placeholder formatting for cleaner directory names

Competing fork idct/composer-custom-directory adds formatting flags to placeholders, enabling transformations like stripping hyphens and capitalizing segments (e.g., {$name|FP} → MyPackage). Our plugin currently supports only raw {$vendor} and {$name} tokens.

Technical Issue & Solution:

Issue: Raw tokens can produce folder names with hyphens/underscores (e.g. my_package), which may not align with PSR‑4 or class naming conventions.

Solution: Extend token parsing to recognize a pipe syntax ({$token|flags}) where flags define transformations (F = capitalize first letter, P = remove separators and uppercase subsequent letters). Implement a small utility to apply string filters during path resolution.

Scope & Goal:

  • Augment the placeholder parser to split on |, parse flags, and apply them in order.
  • Provide documentation with examples ({$name|FP}, {$vendor|U} for uppercase all).
  • Goal: Give developers fine‑grained control over directory naming, reducing post‑install renaming needs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions