thenlabs/class-builder
Composer 安装命令:
composer require thenlabs/class-builder
包简介
Dynamic management of classes, traits and interfaces in PHP.
README 文档
README
Dynamic management of classes, traits and interfaces in PHP.
If you like this project gift us a ⭐.
Documentation.
- English (Pending)
- Español
Installation.
$ composer require thenlabs/class-builder
Require PHP >= 7.2
Example.
The next example shows a way to create dinamically a PHP class using our ClassBuilder.
<?php use ThenLabs\ClassBuilder\ClassBuilder; $personClass = new ClassBuilder('Person'); $personClass->setNamespace('ThenLabs\Demo'); $personClass->addProperty('name')->setAccess('protected'); $personClass->addMethod('__construct', function (string $name) { $this->name = $name; }); $personClass->addMethod('getName', function (): string { return $this->name; }); $personClass->install(); $andy = new Person('Andy'); $andy->getName() === 'Andy'; // true $andy instanceof \ThenLabs\Demo\Person; // true
Development.
Clone this repository and install the Composer dependencies.
$ composer install
Running the tests.
All the tests of this project was written with our testing framework PyramidalTests wich is based on PHPUnit.
Run tests:
$ composer test
统计信息
- 总下载量: 450
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-07