Download the PHP package nacosvel/transformer without Composer

On this page you can find all versions of the php package nacosvel/transformer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package transformer

Transformer

rule-driven data projection and transformation.

GitHub Tag Total Downloads Packagist Version Packagist PHP Version Support Packagist License

Table of Contents
  1. Installation
  2. Usage
  3. Contributing
  4. Contributors
  5. License

Installation

You can install the package via Composer:

[back to top]

规则类说明表

规则 类型 作用 适用场景
ConditionRule 条件规则 根据指定条件过滤、筛选或转换数据,仅当满足条件时执行对应的转换逻辑 1. 仅对特定状态(如“已支付”)的数据进行转换;
2. 根据字段值范围(如金额>100)调整数据展示;
3. 多分支条件下的差异化数据处理
DefaultValueRule 默认值规则 为字段设置预设默认值,保证数据完整性 1. 未填写的用户昵称默认填充为“匿名用户”;
2. 接口返回的空数字字段默认设为0;
3. 缺失的时间字段默认填充为当前时间
FieldMappingRule 字段映射规则 映射源字段与目标字段的名称/值对应关系,实现字段名重命名或值的静态映射 1. 第三方接口字段名(如user_name)映射为本地规范字段(如userName);
2. 枚举值映射(如1→“男”、2→“女”);
3. 多数据源字段统一命名
InvokeRule 调用规则 调用自定义方法/函数/服务对字段进行动态转换,支持复杂业务逻辑的嵌入 1. 对手机号进行脱敏处理(调用脱敏函数);
2. 通过用户ID调用用户服务获取用户名;
3. 对金额字段调用汇率转换方法进行币种换算
MetadataRule 源数据规则 基于源数据填充 --
NestedMappingRule 嵌套映射规则 处理嵌套结构(如对象、数组)的字段映射,支持多层级数据的转换 1. 嵌套对象(如user.address)的字段重命名;
2. 数组内元素的字段映射(如order.items中的price字段);
3. 多层嵌套数据的扁平化处理
WildcardMapperRule 通配符映射规则 处理数组结构的字段映射,支持多层级数据的转换 1. 数组内元素的字段映射;
2. 多层嵌套数据的扁平化处理

Rule Class Description Table

Rule Type Function Applicable Scenarios
ConditionRule Filter, screen or transform data according to specified conditions, and execute the corresponding transformation logic only when the conditions are met 1. Transform data only for specific status (e.g., "Paid");
2. Adjust data display according to field value range (e.g., amount > 100);
3. Differentiated data processing under multi-branch conditions
DefaultValueRule Set default values for fields to ensure data integrity. 1. Default fill "Anonymous User" for unfilled user nicknames;
2. Default set empty numeric fields returned by the interface to 0;
3. Default fill missing time fields with current time
FieldMappingRule Map the name/value correspondence between source fields and target fields to realize field name renaming or static mapping of values 1. Map third-party interface field names (e.g., user_name) to local standard fields (e.g., userName);
2. Enumeration value mapping (e.g., 1→"Male", 2→"Female");
3. Unified naming of multi-data source fields
InvokeRule Call custom methods/functions/services to dynamically transform fields, supporting the embedding of complex business logic 1. Desensitize mobile phone numbers (call desensitization function);
2. Get username by calling user service via user ID;
3. Convert currency of amount fields by calling exchange rate conversion method
MetadataRule Metadata-based population --
NestedMappingRule Handle field mapping of nested structures (e.g., objects, arrays) and support transformation of multi-level data 1. Field renaming of nested objects (e.g., user.address);
2. Field mapping of elements in arrays (e.g., price field in order.items);
3. Flattening of multi-level nested data
WildcardMapperRule Handles field mapping in array structures and supports multi-level data transformation. 1. Field mapping of elements within an array;
2. Flattening of multi-level nested data

Usage

Converter::convert

ConditionRule::class

DefaultValueRule::class

FieldMappingRule::class

InvokeRule::class

NestedMappingRule::class

WildcardMapperRule::class

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

[back to top]

Contributors

Thanks goes to these wonderful people:

contrib.rocks image

Contributions of any kind are welcome!

[back to top]

License

Distributed under the MIT License (MIT). Please see License File for more information.

[back to top]


All versions of transformer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
nacosvel/pipeline Version ^1.1
nacosvel/transformer-mapper Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nacosvel/transformer contains the following files

Loading the files please wait ...