anibalsanchez / create-pattern
使用 trait 实现的轻量级 PHP 静态创建模式
2.2.0
2022-12-06 12:39 UTC
Requires
- php: ^7.3 || ^8.0
This package is auto-updated.
Last update: 2024-09-06 16:24:10 UTC
README
描述
使用 trait 实现的轻量级 PHP 静态创建模式
composer require anibalsanchez/create-pattern
灵感来源于 byjg/SingletonPatternPHP
使用方法
创建你的类
require "vendor/autoload.php"; class Example { // You need to use the trait here use \Extly\Infrastructure\Creator\CreatorTrait; use \Extly\Infrastructure\Creator\SingletonTrait; // Put your code below }
使用你的类
$example = Example::create();
$example = Example::getInstance();
安装
只需输入: composer require anibalsanchez/create-pattern
参考资料
许可证
MIT 许可证 (MIT)