PHPackages                             zero-to-prod/psr4-varname - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zero-to-prod/psr4-varname

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zero-to-prod/psr4-varname
=========================

Generates a valid PSR-4 Compliant variable name from a string.

v2.1.0(8mo ago)17702MITDockerfilePHP &gt;=7.1CI passing

Since Jan 1Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/zero-to-prod/psr4-varname)[ Packagist](https://packagist.org/packages/zero-to-prod/psr4-varname)[ Docs](https://github.com/zero-to-prod/psr4-varname)[ Fund](https://github.com/sponsors/zero-to-prod)[ RSS](/packages/zero-to-prod-psr4-varname/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (2)

Zerotoprod\\Psr4VarName
=======================

[](#zerotoprodpsr4varname)

[![](art/logo.png)](art/logo.png)

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/psr4-varname)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/ccbda7383bf4dd2cdc5c33058ea6e10aa0201a164c5074d0f43d4779cefa53b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f707372342d7661726e616d652f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/psr4-varname/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/d8f6ff79b3b12125e00ff65ab5992d287d381d876c6a26aa7d14a7fc2a05ec20/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f707372342d7661726e616d652f6261636b77617264735f636f6d7061746962696c6974792e796d6c3f6c6162656c3d6261636b77617264735f636f6d7061746962696c697479)](https://github.com/zero-to-prod/psr4-varname/actions)[![Packagist Downloads](https://camo.githubusercontent.com/0d15753e55195c8de99edb41038e4d7bfcc473b931898c63cf3b22e5e71bde83/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f707372342d7661726e616d653f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/psr4-varname/stats)[![php](https://camo.githubusercontent.com/d2041b22543ff30b671ebf1c5e2ef60f4db8a71f42f637f9411b4b878abe7f86/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a65726f2d746f2d70726f642f707372342d7661726e616d652e7376673f636f6c6f723d707572706c65)](https://packagist.org/packages/zero-to-prod/psr4-varname/stats)[![Packagist Version](https://camo.githubusercontent.com/9d3470fd4a146d17dfdf9890f343f6d0ce8ea8d511f415393e61f6b91753bacc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f707372342d7661726e616d653f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/psr4-varname)[![License](https://camo.githubusercontent.com/b5f09648c7a5793f323eaed958b8c09ba7ec0a374982cb2df6bcb0a3a333a756/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f707372342d7661726e616d653f636f6c6f723d70696e6b)](https://github.com/zero-to-prod/psr4-varname/blob/main/LICENSE.md)[![wakatime](https://camo.githubusercontent.com/332c7bb1effea9f6db7ea51d4df5b8f7394176ece7d29aade8519c6d1a419a11/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f7a65726f2d746f2d70726f642f707372342d7661726e616d652e737667)](https://wakatime.com/badge/github/zero-to-prod/psr4-varname)[![Hits-of-Code](https://camo.githubusercontent.com/1934619a7c1fa2c2753eae6b95a4c879b523436ad3776eae530540b7ad310a0a/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f646174612d6d6f64656c2d616461707465722d6f70656e61706933303f6272616e63683d6d61696e)](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
------------

[](#introduction)

Generates a valid PSR-4 Compliant variable name from a string.

Requirements
------------

[](#requirements)

- PHP 7.1 or higher.

Installation
------------

[](#installation)

Install `Zerotoprod\Psr4VarName` via [Composer](https://getcomposer.org/):

```
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
------------------------

[](#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-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

[](#automatic-documentation-publishing)

You can automatically publish documentation by adding the following to your `composer.json`:

```
{
    "scripts": {
        "post-install-cmd": [
            "zero-to-prod-psr4-varname"
        ],
        "post-update-cmd": [
            "zero-to-prod-psr4-varname"
        ]
    }
}
```

Usage
-----

[](#usage)

```
use Zerotoprod\Psr4Classname\VarName;

VarName::generate('weird%characters*in^name'); // 'weird_characters_in_name';
```

Contributing
------------

[](#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.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance60

Regular maintenance activity

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~40 days

Recently: every ~57 days

Total

7

Last Release

253d ago

Major Versions

v1.0.2 → v2.0.02025-02-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/502649f05d36c87d494988bd99193a4d908d345335d99c080928a726277371f5?d=identicon)[zero-to-prod](/maintainers/zero-to-prod)

---

Top Contributors

[![zero-to-prod](https://avatars.githubusercontent.com/u/61474950?v=4)](https://github.com/zero-to-prod "zero-to-prod (16 commits)")

---

Tags

phppsr-4zero-to-prodpsr4 varname

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-to-prod-psr4-varname/health.svg)

```
[![Health](https://phpackages.com/badges/zero-to-prod-psr4-varname/health.svg)](https://phpackages.com/packages/zero-to-prod-psr4-varname)
```

###  Alternatives

[zero-to-prod/data-model

Transforms Data into Type-Safe DTOs.

14226.2k32](/packages/zero-to-prod-data-model)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
