{"id":24523762,"url":"https://github.com/workofstan/phpcs-fix","last_synced_at":"2026-01-02T12:50:52.445Z","repository":{"id":272995050,"uuid":"918410671","full_name":"WorkOfStan/phpcs-fix","owner":"WorkOfStan","description":"Automatically apply PHP coding standard formatting and create a pull request to fix code style issues, ensuring compatibility with Super-Linter.","archived":false,"fork":false,"pushed_at":"2025-03-01T14:48:48.000Z","size":23,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T23:02:09.954Z","etag":null,"topics":["code-quality","continuous-integration","phpcbf","phpcs","phpcs-standard","super-linter"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WorkOfStan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T21:54:30.000Z","updated_at":"2025-02-09T00:04:25.000Z","dependencies_parsed_at":"2025-02-21T22:20:53.147Z","dependency_job_id":"e52c56a9-53cf-4ba7-a939-252320e420d8","html_url":"https://github.com/WorkOfStan/phpcs-fix","commit_stats":null,"previous_names":["workofstan/phpcs-fix"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorkOfStan%2Fphpcs-fix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WorkOfStan","download_url":"https://codeload.github.com/WorkOfStan/phpcs-fix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243738979,"owners_count":20340002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-quality","continuous-integration","phpcbf","phpcs","phpcs-standard","super-linter"],"created_at":"2025-01-22T04:16:42.407Z","updated_at":"2026-01-02T12:50:52.439Z","avatar_url":"https://github.com/WorkOfStan.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPCS-Fix\n\n**PHP Code Beautifier and Fixer** is a GitHub Action that checks your PHP code for style issues using the supported [PHPCSStandards/PHP_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/) and automatically attempts to fix them using phpcbf ensuring compatibility with [Super-Linter](https://github.com/super-linter/super-linter).\n(Note that the original [squizlabs/PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) was abandoned.)\nThis action can either commit changes directly to the current branch or create a new branch if you prefer manual review via pull request.\n\n## Features\n\n- **Automatic Fixes:** Check PHP files for coding standard violations and attempts to automatically fix them when possible.\n- **Flexible Committing:** Creates a new branch (prefixed with `phpcbf/fix`) if changes are required, making it easy to review and merge. Or you can set the input parameter `commit-changes: true` to commit to the current branch. (Recommendation: start with committing to another branch and review in order to avoid surprises. Then commit to the same branch for incremental changes.)\n- **Configurable:** Adjust extensions, ignore and standard parameters of phpcs. Adjust PHP version, or commit-message.\n- **Caching:** Cache `vendor/` (for a unique combination of php-version and composer.json) after a successful run in order to speed up further runs.\n- **GitHub Action Chain:** Either leave this GitHub Action non-blocking or set `stop-on-manual-fix` according to your automation process needs.\n- **Direct link to a new commit:** A URL to the new commit is displayed as a notice to allow for a quick check of what's been changed.\n\n## Usage\n\nThis action is designed to be used as a _reusable workflow_. You can call it from another workflow in your repository or simply add [the provided YAML configuration](.github/workflows/phpcs-phpcbf.yml) to your repository.\n\nBy default, if necessary, a new branch with a name starting with `phpcbf/fix` will be created, making it easy to review and merge fixes into your main branch.\n\nNote 1: This action is non-blocking, so the status remains green even when changes are proposed via a new branch.\nA notice message is displayed, and it is then up to you to either create a pull request to merge the changes or delete the branch.\n\nNote 2: However, you can mandate the action to stop if manual fixes are necessary by setting the input parameter `stop-on-manual-fix: true`.\n\n### Permissions\n\nThis action requires the following permissions:\n\n```yaml\npermissions:\n  contents: write\n```\n\n### Inputs (all optional)\n\n| Input                | Description                                                                                                                  | Type    | Default                                                                                                                                                                                                                                                                                              |\n| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `commit-changes`     | If set to `true`, the action will commit changes to the current branch; otherwise a new branch is created for manual review. | Boolean | `false`                                                                                                                                                                                                                                                                                              |\n| `commit-message`     | Commit message to use if the action commits changes.                                                                         | String  | `\"chore(phpcf): apply PHP Code Beautifier fixes automatically\"`                                                                                                                                                                                                                                      |\n| `debug`              | Enable extra debug output (list of branches).                                                                                | Boolean | `false`                                                                                                                                                                                                                                                                                              |\n| `extensions`         | Comma-delimited list of file extensions to be sniffed. Note: an empty value will disable checking.                           | String  | `\"php\"` (defaults to PHP only; other file types must be specified)                                                                                                                                                                                                                                   |\n| `ignore`             | Ignore files based on a comma-separated list of patterns matching files and/or directories.                                  | String  | `vendor/`                                                                                                                                                                                                                                                                                            |\n| `php-version`        | The PHP version to use, e.g. `\"8.2\"`.                                                                                        | String  | `\"8.2\"`                                                                                                                                                                                                                                                                                              |\n| `standard`           | The name of, or the path to, the coding standard to use. Can be a comma-separated list specifying multiple standards.        | String  | The project's `.github/linters/phpcs.xml` (where Super-linter expects it) with fallback to \u003chttps://github.com/super-linter/super-linter/blob/main/TEMPLATES/phpcs.xml\u003e copied to [.github/linters/super-linter-templates-phpcs.xml](.github/linters/super-linter-templates-phpcs.xml) will be used. |\n| `stop-on-manual-fix` | If true, the execution will stop when manual fixes are necessary.                                                            | Boolean | `false`                                                                                                                                                                                                                                                                                              |\n\n### Outputs\n\n| Output          | Description                                     |\n| --------------- | ----------------------------------------------- |\n| `branch-name`   | The name of the branch created/used             |\n| `changed-files` | Comma-separated list of files changed by phpcbf |\n\n## Caching Mechanism\n\nTo optimize execution time, the `vendor` folder is cached, allowing dependencies to be reused across workflow runs. The cache key is generated based on:\n\n- `composer.json` – to track dependency changes.\n- The runner's OS and PHP version – to account for environment-specific variations.\n\nThis approach enables cache sharing across branches. However, if the `composer.json` file in the referenced branch (e.g., `dev`) changes, it's recommended to **invalidate the cache** to ensure a fresh `vendor` folder is built from scratch.\n\nThe cache name (key) is `phpcs-fix-${{ runner.os }}-PHP${{ inputs.php-version }}-vendor-${{ hashFiles('**/composer.json') }}`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkofstan%2Fphpcs-fix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkofstan%2Fphpcs-fix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkofstan%2Fphpcs-fix/lists"}