https://github.com/ghostwriter/phormat
[WIP] PHP code formatter.
https://github.com/ghostwriter/phormat
coding-standard ghostwriter phormat
Last synced: 10 months ago
JSON representation
[WIP] PHP code formatter.
- Host: GitHub
- URL: https://github.com/ghostwriter/phormat
- Owner: ghostwriter
- License: other
- Created: 2024-01-29T21:17:15.000Z (about 2 years ago)
- Default Branch: 0.1.x
- Last Pushed: 2025-04-22T01:02:20.000Z (10 months ago)
- Last Synced: 2025-04-22T02:26:45.869Z (10 months ago)
- Topics: coding-standard, ghostwriter, phormat
- Language: PHP
- Homepage: https://github.com/ghostwriter/phormat
- Size: 688 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Phormat
[](https://github.com/sponsors/ghostwriter)
[](https://github.com/ghostwriter/phormat/actions/workflows/automation.yml)
[](https://www.php.net/supported-versions)
[](https://packagist.org/packages/ghostwriter/phormat)
PHP code formatter.
> [!WARNING]
>
> This project is not finished yet, work in progress.
## Installation
You can install the package via composer:
``` bash
composer require ghostwriter/phormat
```
### Star ⭐️ this repo if you find it useful
You can also star (🌟) this repo to find it easier later.
## Usage
```php
vendor/bin/phormat --dry-run
```
## Configuration
wip - work in progress
```php
visitors([
PERCSNodeVisitor::class,
// ChangeToShortArrayNodeVisitor::class,
// DeclareStrictTypesNodeVisitor::class,
// ImportFullyQualifiedNamesNodeVisitor::class,
// MakeClosureAndFunctionStaticNodeVisitor::class,
// SortClassLikeMemberStatementsAlphabeticallyNodeVisitor::class,
// SortClassLikeStatementsAlphabeticallyNodeVisitor::class,
// SortMatchExpressionsAlphabeticallyNodeVisitor::class,
// SortUseStatementsAlphabeticallyNodeVisitor::class,
]);
->paths([
$workingDirectory . '/bin',
$workingDirectory . '/src',
$workingDirectory . '/tests'
])
->exclude([
PERCSNodeVisitor::class => [
$workingDirectory . '/resources',
],
$workingDirectory . '/.cache',
$workingDirectory . '/docs',
$workingDirectory . '/tests/fixture'
$workingDirectory . '/vendor',
]);
->phpVersion(8, 2); // To use a specific PHP version when parsing the code
```
### Credits
- [Nathanael Esayeas](https://github.com/ghostwriter)
- [Nikita Popov `nikic/php-parser`](https://github.com/nikic/php-parser)
- [All Contributors](https://github.com/ghostwriter/phormat/contributors)
### Changelog
Please see [CHANGELOG.md](./CHANGELOG.md) for more information on what has changed recently.
### License
Please see [LICENSE](./LICENSE) for more information on the license that applies to this project.
### Security
Please see [SECURITY.md](./SECURITY.md) for more information on security disclosure process.