{"id":21722774,"url":"https://github.com/vishwac09/extended-php-guidelines","last_synced_at":"2025-07-18T18:30:41.188Z","repository":{"id":195938193,"uuid":"464345612","full_name":"vishwac09/extended-php-guidelines","owner":"vishwac09","description":"Provides set of additional coding standards","archived":true,"fork":false,"pushed_at":"2022-03-01T16:34:10.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T22:18:57.610Z","etag":null,"topics":["php","phpcs-standard"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vishwac09.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-02-28T05:06:40.000Z","updated_at":"2023-10-17T07:31:57.000Z","dependencies_parsed_at":"2023-09-20T07:43:38.930Z","dependency_job_id":null,"html_url":"https://github.com/vishwac09/extended-php-guidelines","commit_stats":null,"previous_names":["vishwac09/extended-php-guidelines"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vishwac09/extended-php-guidelines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishwac09%2Fextended-php-guidelines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishwac09%2Fextended-php-guidelines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishwac09%2Fextended-php-guidelines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishwac09%2Fextended-php-guidelines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vishwac09","download_url":"https://codeload.github.com/vishwac09/extended-php-guidelines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishwac09%2Fextended-php-guidelines/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265809833,"owners_count":23831940,"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":["php","phpcs-standard"],"created_at":"2024-11-26T02:32:53.365Z","updated_at":"2025-07-18T18:30:40.855Z","avatar_url":"https://github.com/vishwac09.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extended PHP Guidelines\n\nApart from the [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/), [PSR-12](https://www.php-fig.org/psr/psr-12/)\nand the [Drupal](https://www.drupal.org/docs/develop/standards) standard's, we follow few [more](#List) to achieve consistency of code project wide.\n\nI work mostly on Drupal projects, so normally use the Drupal Coding standard to sniff the custom code for any violations.\nThis PHP library is a type of PHP-CodeSniffer standard which checks PHP code against the below list.\n\n## List\n\n1. Order of imports - `Group Drupal/Symfony imports and third party libraries added via composer separately.`\n2. Avoid Switch case - `PHP \u003e= 8.0 provides match() {} expression, can be replaced in place of switch() case:.`\n3. Avoid Static Class references - `Cannot be injected.`\n4. Order of member functions - `Order member function in ascending order, improves readability.`\n\n## Usage\n\nCreate a project, and add this packages as __DEV__ dependancy.\n\n#### Installation\nAdd via composer as local dependencies\n```\ncomposer require --dev dealerdirect/phpcodesniffer-composer-installer\ncomposer require --dev vishwac09/extended-php-guidelines\n```\n\n__OR__\n\nAdd via composer as global dependencies\n```\ncomposer require global --dev dealerdirect/phpcodesniffer-composer-installer\ncomposer require global --dev vishwac09/extended-php-guidelines\n```\n\nAdd via GIT\n```\ngit clone git@github.com:vishwac09/extended-php-guidelines.git\n```\n\nadd the standard to phpcs\n\n```\nphpcs --config-set installed_paths /path/to/extended-php-guidelines/EPG\n```\n### Run\n\nCheck if the new stanadard is configures with phpcs.\n\n```\nphpcs -i\n```\n\nSniff code for the above violation.\n\n```\nphpcs --standard=EPG --colors file1.php, file2.inc\n```\n\n### Example\n\n```\nFILE: /Users/hp/Documents/temp.php\n------------------------------------------------------------------------------------------------------\nFOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES\n------------------------------------------------------------------------------------------------------\n  1 | WARNING | Group Drupal/Symfony imports and third party libraries added via composer separately.\n 26 | WARNING | Member functions of class must be defined in ascending order\n 28 | WARNING | Do not use static class references.\n 40 | WARNING | Member functions of interface must be defined in ascending order\n 50 | WARNING | Do not use switch expression. With PHP \u003e= 8.0 use the new match expression\n    |         | (https://www.php.net/manual/en/control-structures.match.php).\n------------------------------------------------------------------------------------------------------\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishwac09%2Fextended-php-guidelines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvishwac09%2Fextended-php-guidelines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishwac09%2Fextended-php-guidelines/lists"}