{"id":20052436,"url":"https://github.com/hyperjiang/php-design-pattern","last_synced_at":"2026-05-06T16:06:17.461Z","repository":{"id":126841709,"uuid":"59537403","full_name":"hyperjiang/php-design-pattern","owner":"hyperjiang","description":"PHP设计模式","archived":false,"fork":false,"pushed_at":"2017-12-27T05:35:14.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T08:45:56.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/hyperjiang.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-24T03:26:39.000Z","updated_at":"2018-09-15T02:29:52.000Z","dependencies_parsed_at":"2023-06-18T07:00:43.492Z","dependency_job_id":null,"html_url":"https://github.com/hyperjiang/php-design-pattern","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hyperjiang/php-design-pattern","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjiang%2Fphp-design-pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjiang%2Fphp-design-pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjiang%2Fphp-design-pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjiang%2Fphp-design-pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperjiang","download_url":"https://codeload.github.com/hyperjiang/php-design-pattern/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjiang%2Fphp-design-pattern/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32701408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-13T12:17:42.361Z","updated_at":"2026-05-06T16:06:17.456Z","avatar_url":"https://github.com/hyperjiang.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP设计模式 #\n\n对于设计模式相信大家都不陌生，但在实际项目中可能大家很少会仔细思考应该使用什么样的设计模式。其实使用了设计模式会让代码更健壮和易维护，我后面会举些例子来说明使用设计模式的好处。\n\n## 设计模式的归类  ##\n\n设计模式主要分为三大类：**生成模式**，**结构模式**，**行为模式**，下面是一些较常见的模式。\n\n### 生成模式 (Creational) ###\n\n- [Singleton (单例模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/creational/Singleton.php)\n- [Simple Factory (简单工厂模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/creational/SimpleFactory.php)\n- [StaticFactory (静态工厂模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/creational/StaticFactory.php)\n- [Abstract Factory (抽象工厂模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/creational/AbstractFactory.php)\n- [Factory Method (工厂方法模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/creational/FactoryMethod.php)\n- [Builder (生成器模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/creational/Builder.php)\n\n### 结构模式 (Structural) ###\n\n- [Adapter (转接器模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/structural/Adapter.php)\n- [Bridge (桥接模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/structural/Bridge.php)\n- [Composite (合成模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/structural/Composite.php)\n- [DependencyInjection (依赖注入模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/structural/DependencyInjection.php)\n- [Facade (表象模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/structural/Facade.php)\n\n### 行为模式 (Behavioral) ###\n\n- [Command (命令模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/behavioral/Command.php)\n- [Iterator (迭代器模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/behavioral/Iterator.php)\n- [Observer (观察者模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/behavioral/Observer.php)\n- [Visitor (访客模式)](https://github.com/hyperjiang/php-design-pattern/tree/master/behavioral/Visitor.php)\n\n## 核心思想 ##\n设计模式的核心思想是**分而治之**，把复杂的逻辑分解成一个个相对简单的子模块，每个子模块只完成具体的简单逻辑，解耦解得好，以后整个系统就会更便于扩展和维护。学习了设计模式也不必生搬硬套，多看优秀框架的代码，比如lavavel，zend framework等，潜移默化必有所成。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjiang%2Fphp-design-pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperjiang%2Fphp-design-pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjiang%2Fphp-design-pattern/lists"}