ervin-meng / php-design-patterns
PHP设计模式
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:application
Requires
- php: >=5.5.0
This package is auto-updated.
Last update: 2025-06-29 01:50:18 UTC
README
代码示例
<?php use PHPDesignPatterns\Creational\Builder\Builder; use PHPDesignPatterns\Creational\Builder\Director; use PHPDesignPatterns\Creational\Singleton\Singleton; use PHPDesignPatterns\Creational\Prototype\Prototype; //原型模式 $prototype = new Prototype(); $prototype->setStatus(1); $prototypeOne = clone $prototype; echo $prototypeOne->getStatus(); //单例模式 $instance = Singleton::getInstance(); //创建者模式 $director = new Director(); $builder = new Builder(); $director->build($builder);