{"id":18859804,"url":"https://github.com/mybb/standards","last_synced_at":"2025-10-04T20:13:03.082Z","repository":{"id":30767297,"uuid":"34324000","full_name":"mybb/standards","owner":"mybb","description":"MyBB 2.0 Code Standards.","archived":false,"fork":false,"pushed_at":"2015-05-10T08:48:50.000Z","size":119,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-09-21T00:36:30.984Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.mybb.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mybb.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-21T11:53:31.000Z","updated_at":"2016-09-07T13:17:12.000Z","dependencies_parsed_at":"2022-08-23T12:20:08.078Z","dependency_job_id":null,"html_url":"https://github.com/mybb/standards","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mybb/standards","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mybb%2Fstandards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mybb%2Fstandards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mybb%2Fstandards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mybb%2Fstandards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mybb","download_url":"https://codeload.github.com/mybb/standards/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mybb%2Fstandards/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278366672,"owners_count":25975097,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-08T04:19:17.704Z","updated_at":"2025-10-04T20:13:03.065Z","avatar_url":"https://github.com/mybb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyBB 2.0 Coding Standard\r\nThis repository contains the coding standard for MyBB 2.0. These files are supposed to be used as a standard for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) and are run automatically against all repositories related to MyBB 2.0.\r\n\r\n## Standard\r\n\r\nPHP code must follow the [PSR-2](http://www.php-fig.org/psr/psr-2/) coding style guide. [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) will be ran against all contributions to ensure that code follows this standard. \r\n\r\nIn addition to the PSR-2 standard, we have other standards and best practices that must be ahered to:\r\n\r\n- All interface names MUST be suffixed with `Interface`. (e.g. `ForumInterface`).\r\n- All abstract class names MUST be prefixed with `Abstract` (e.g. `AbstractForum`).\r\n- All repository class names MUST be suffixed with `Repository` (e.g. `ForumRepository`).\r\n- All factory class names MUST be suffixed with `Factory` (e.g. `ForumFactory`).\r\n- The `Interface` suffix MUST take priority over other suffixes. (e.g. `ForumRepositoryInterface`, `ForumFactoryInterface`.\r\n- Getters MUST be used when retrieving the property of a non-Eloquent object.\r\n- Setters MUST be used when manipulating the property of a non-Eloquent object.\r\n- Properties on an object SHOULD have `protected` or `private` visibility.\r\n\r\n```php\r\n/**\r\n * @property string magic\r\n */\r\nclass Foo\r\n{\r\n    /**\r\n     * @var string\r\n     */\r\n    protected $bar;\r\n    \r\n    /**\r\n     * @return string;\r\n     */\r\n    public function getBar()\r\n    {\r\n        return $this-\u003ebar;\r\n    }\r\n    \r\n    /**\r\n     * @param string $bar\r\n     */\r\n    public function setBar($bar)\r\n    {\r\n        $this-\u003ebar = $bar;\r\n    }\r\n    \r\n    /**\r\n     * @param string $name\r\n     */\r\n    public function __get($name)\r\n    {\r\n        return 'magic';\r\n    }\r\n}\r\n```\r\n\r\n- Methods with a return value and/or arguments MUST have a document block.\r\n- Object properties MUST have a document block with `@var` tag denoting their type.\r\n- Magic properties on an object MUST be declared in a doc block at the top of the class using the `@property` tag.\r\n- Method arguments that are required MUST NOT have a default value.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmybb%2Fstandards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmybb%2Fstandards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmybb%2Fstandards/lists"}