zero-to-prod / psr4-classname-cli
A CLI to generate a PSR-4 compliant classname
Fund package maintenance!
Github
Requires
- php: >=8.1
- ext-json: *
- symfony/console: ^7.2
- zero-to-prod/data-model: ^81.9
- zero-to-prod/package-helper: ^1.1.3
- zero-to-prod/psr4-classname: ^71.0
Requires (Dev)
- phpunit/phpunit: <12.0
This package is auto-updated.
Last update: 2025-09-02 01:52:20 UTC
README
Contents
- Introduction
- Requirements
- Installation
- Documentation Publishing
- Usage
- Docker Image
- Local Development
- Image Development
- Contributing
Introduction
A CLI to generate a PSR-4 compliant classname
Requirements
- PHP 8.1 or higher.
Installation
Install Zerotoprod\Psr4ClassnameCli
via Composer:
composer require zero-to-prod/psr4-classname-cli
This will add the package to your project's dependencies and create an autoloader entry for it.
Documentation Publishing
You can publish this README to your local documentation directory.
This can be useful for providing documentation for AI agents.
This can be done using the included script:
# Publish to default location (./docs/zero-to-prod/psr4-classname-cli) vendor/bin/zero-to-prod-psr4-classname-cli # Publish to custom directory vendor/bin/zero-to-prod-psr4-classname-cli /path/to/your/docs
Automatic Documentation Publishing
You can automatically publish documentation by adding the following to your composer.json
:
{ "scripts": { "post-install-cmd": [ "zero-to-prod-psr4-classname-cli" ], "post-update-cmd": [ "zero-to-prod-psr4-classname-cli" ] } }
Usage
Run this command to see the available commands:
vendor/bin/psr4-classname-cli list
Available Commands
psr4-classname-cli:generate
Description: Generates a valid PSR-4 compliant classname from a string.
Usage:
vendor/bin/psr4-classname-cli psr4-classname-cli:generate <classname>
Arguments:
classname
(required) - The string to convert to a PSR-4 compliant classname
Examples:
# Generate a classname from a simple string vendor/bin/psr4-classname-cli psr4-classname-cli:generate "my class" # Output: MyClass # Generate a classname from a string with special characters vendor/bin/psr4-classname-cli psr4-classname-cli:generate "user-profile_manager" # Output: UserProfileManager # Generate a classname from a string with numbers vendor/bin/psr4-classname-cli psr4-classname-cli:generate "api v2 client" # Output: ApiV2Client
psr4-classname-cli:src
Description: Displays the project's GitHub repository URL.
Usage:
vendor/bin/psr4-classname-cli psr4-classname-cli:src
Arguments: None
Example:
vendor/bin/psr4-classname-cli psr4-classname-cli:src
# Output: https://github.com/zero-to-prod/psr4-classname-cli
Docker Image
You can also run the cli using the docker image:
docker run --rm davidsmith3/psr4-classname-cli
Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.