https://github.com/zero-to-prod/psr4-varname
Generates a valid PSR-4 Compliant variable name from a string.
https://github.com/zero-to-prod/psr4-varname
php psr-4
Last synced: 4 months ago
JSON representation
Generates a valid PSR-4 Compliant variable name from a string.
- Host: GitHub
- URL: https://github.com/zero-to-prod/psr4-varname
- Owner: zero-to-prod
- License: mit
- Created: 2025-01-01T17:03:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-01T22:42:41.000Z (10 months ago)
- Last Synced: 2025-10-03T21:38:29.263Z (9 months ago)
- Topics: php, psr-4
- Language: Dockerfile
- Homepage: https://zero-to-prod.github.io/psr4-varname/
- Size: 165 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Zerotoprod\Psr4VarName

[](https://github.com/zero-to-prod/psr4-varname)
[](https://github.com/zero-to-prod/psr4-varname/actions)
[](https://github.com/zero-to-prod/psr4-varname/actions)
[](https://packagist.org/packages/zero-to-prod/psr4-varname/stats)
[](https://packagist.org/packages/zero-to-prod/psr4-varname/stats)
[](https://packagist.org/packages/zero-to-prod/psr4-varname)
[](https://github.com/zero-to-prod/psr4-varname/blob/main/LICENSE.md)
[](https://wakatime.com/badge/github/zero-to-prod/psr4-varname)
[](https://hitsofcode.com/github/zero-to-prod/data-model-adapter-openapi30/view?branch=main)
- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
- [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)
## Introduction
Generates a valid PSR-4 Compliant variable name from a string.
## Requirements
- PHP 7.1 or higher.
## Installation
Install `Zerotoprod\Psr4VarName` via [Composer](https://getcomposer.org/):
```shell
composer require zero-to-prod/psr4-varname
```
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:
```bash
# Publish to default location (./docs/zero-to-prod/psr4-varname)
vendor/bin/zero-to-prod-psr4-varname
# Publish to custom directory
vendor/bin/zero-to-prod-psr4-varname /path/to/your/docs
```
### Automatic Documentation Publishing
You can automatically publish documentation by adding the following to your `composer.json`:
```json
{
"scripts": {
"post-install-cmd": [
"zero-to-prod-psr4-varname"
],
"post-update-cmd": [
"zero-to-prod-psr4-varname"
]
}
}
```
## Usage
```php
use Zerotoprod\Psr4Classname\VarName;
VarName::generate('weird%characters*in^name'); // 'weird_characters_in_name';
```
## Contributing
Contributions, issues, and feature requests are welcome!
Feel free to check the [issues](https://github.com/zero-to-prod/psr-varname/issues) page if you want to contribute.
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a new Pull Request.