https://github.com/ixnode/php-naming-conventions
PHP Naming Conventions
https://github.com/ixnode/php-naming-conventions
Last synced: 4 months ago
JSON representation
PHP Naming Conventions
- Host: GitHub
- URL: https://github.com/ixnode/php-naming-conventions
- Owner: ixnode
- License: mit
- Created: 2022-12-18T17:15:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-18T20:21:36.000Z (12 months ago)
- Last Synced: 2025-02-10T00:47:14.581Z (5 months ago)
- Language: PHP
- Size: 53.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Naming Conventions
[](https://github.com/ixnode/php-naming-conventions/releases)
[](https://github.com/ixnode/php-naming-conventions/releases)

[](https://www.php.net/supported-versions.php)
[](https://phpstan.org/user-guide/rule-levels)
[](https://phpunit.de)
[](https://www.php-fig.org/psr/psr-12/)
[](https://github.com/phpmd/phpmd)
[](https://github.com/rectorphp/rector)
[](https://github.com/ixnode/php-api-version-bundle/blob/master/LICENSE)> This library translate a given string or convention into another convention.
> The following conventions are supported:| Convention | Representation |
|----------------|------------------------|
| `raw` | A raw string |
| `words` | ['a', 'raw', 'string'] |
| `title` | A Raw String |
| `pascalCase` | ARawString |
| `camelCase` | aRawString |
| `under_scored` | a_raw_string |
| `config` | a.raw.string |
| `constant` | A_RAW_STRING |## Installation
```bash
composer require ixnode/php-naming-conventions
``````bash
vendor/bin/php-naming-conventions -V
``````bash
php-naming-conventions 0.1.0 (12-18-2022 01:17:26) - Björn Hempel
```## Usage
```php
use Ixnode\PhpNamingConventions\NamingConventions;
``````php
$rawString = 'Group Private';print (new NamingConventions($rawString))->getTitle();
// (string) Group Privateprint (new NamingConventions($rawString))->getPascalCase();
// (string) GroupPrivateprint (new NamingConventions($rawString))->getCamelCase();
// (string) groupPrivateprint (new NamingConventions($rawString))->getUnderscored();
// (string) group_privateprint (new NamingConventions($rawString))->getConstant();
// (string) GROUP_PRIVATEprint (new NamingConventions($rawString))->getConfig();
// (string) group.privateprint (new NamingConventions($rawString))->getSeparated();
// (string) group-privateprint (new NamingConventions($rawString))->getRaw();
// (string) Group Privateprint (new NamingConventions($rawString))->getWords();
// (array) [[0] => group, [1] => private]
```## Development
```bash
git clone [email protected]:ixnode/php-naming-conventions.git && cd php-naming-conventions
``````bash
composer install
``````bash
composer test
```## License
This tool is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details