Forrest logo
back to the phpcbf tool

phpcbf:tldr:6e0d9

phpcbf: Specify comma-separated file extensions to include when sniffing.
$ phpcbf ${path-to-directory} --extensions ${file_extension(s)}
try on your machine

This command is used to format PHP code according to a specified coding standard. Here's a breakdown of the command:

The command starts with phpcbf, which stands for PHP Code Beautifier and Fixer. This tool automatically fixes coding style issues in PHP files.

${path-to-directory} is a placeholder for the path to the directory containing the PHP files that you want to format. You need to replace this placeholder with the actual path on your system.

--extensions is an option that specifies the file extension(s) of the PHP files that you want to format. ${file_extension(s)} is a placeholder for one or more file extensions, separated by commas. For example, if you want to format all PHP files in the specified directory, you can use --extensions php.

By running this command, the PHPCBF tool will analyze the PHP files in the specified directory (and its subdirectories) with the specified file extension(s) and automatically fix any identified coding style issues. This can include issues related to indentation, line length, spacing, and other coding standards defined by the tool or a coding standard you have configured.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the phpcbf tool