emeraldinspirations/lib-createconstructcallable
Composer 安装命令:
composer require emeraldinspirations/lib-createconstructcallable
包简介
Returns an anonymous callable function referencing the constructor of a class
README 文档
README
lib-createconstructcallable
A component of emeraldinspiration's library.
Returns an anonymous callable function referencing the constructor of a class
PHP does not yet have a syntax for creating a callable for the constructor of a class. Some workarounds involve using ReflectionClass. (See: https://stackoverflow.com/q/24129450/6699286)
This class provides an alternate option. It creates an anonymous function that fulfills the callable need and runs the relevant constructor.
Installing / Getting started
This project has no dependencies, so can simply be required with composer
composer require emeraldinspirations/lib-createconstructcallable
How to use
<?php $Callable = ConstructCallableCreator::createConstructCallable( ExampleClass::class ); $NewClass = $Callable($Param1, $Param2); //Same result as new ExampleClass($Param1, $Param2)
Licensing
The code in this project is licensed under MIT license.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-03