定制 sebk/small-class-manipulator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sebk/small-class-manipulator

最新稳定版本:1.0.0

Composer 安装命令:

composer require sebk/small-class-manipulator

包简介

README 文档

README

This lib allow you to read and parse a php file containing class into a php object.

You can then easily add or remove components and rewrite file with modifications.

Migrated

This lib has been migrated to framagit project.

A new composer package is available at https://packagist.org/packages/small/class-manipulator

Future commits will be done on framagit.

This repository will be removed in few month.

Parsing and generating classes

Manipulator instanciation

To parse a class, you must instanciate ClassManipulator :

$classManipulator = new ClassManipulator([
        'rootDir' => __DIR__ . '/../data',
        'selectors' => [
            'test' => [
                'testing' => [
                    'namespace' => 'DataTest\Testing',
                    'path' => 'DataTest',
                ], 'empty' => [
                    'namespace' => 'Empty',
                    'path' => 'Empty',
                ],
            ]
        ],
    ]);

The "rootDir" parameter is your "src" directory.

The selectors allow you to isolate namespaces params by categories. Here we have injecting only a "test" selector.

In the test selector, we have as many of namespaces we want and each namespace must contain a namespace and corresponding directory path.

Parsing

You can now parse a class :

$classFile = $this->classManipulator->getClass('test', \Empty\Testing\TestClass::class);

This will return a ClassFile

Unit test

To run unit tests, you are required to install docker and docker-compose :

$ apt-get install docker docker-compose

Then go to root of lib and run :

$ docker-compose up -d --build

If the tests fail the command will return an error.

In development, you can set argument "BUILD" to 0 in docker-compose.yml, then the container will not stop, allow you to run tests using :

$ bin/test

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-01-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固