sf4/populator
Composer 安装命令:
composer require sf4/populator
包简介
Populator is a simple Array-To-Object library which transforms arrays into a given object
关键字:
README 文档
README
Populator is a simple Array-To-Object library which transforms arrays into a given object
Structure
If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.
bin/
config/
src/
tests/
vendor/
Install
Via Composer
$ composer require sf4/populator
Usage
namespace Acme\Model; class Foo { protected $bar; public $public; public $publicWithSetter; public function setBar($bar) { $this->bar = $bar; } public function getBar() { return $this->bar; } public function setPublicWithSetter($var) { $this->publicWithSetter = $var; } } $data = array( 'bar' => 'Foobaz!', 'public' => 'Public!' 'publicWithSetter' => 'BySetter' ); /** * You can give either classname or an instance */ $foo = new Acme\Model\Foo(); $foo = 'Acme\Model\Foo'; $populator = new Sf4\Populator(); $newFoo = $populator->populate($data, $foo); echo $newFoo->getBar(); // Foobaz! echo $newFoo->public; // Public! echo $newFoo->publicWithSetter; // BySetter
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email siim.liimand@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 353
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-16