imanaging-document/check-format-bundle
Composer 安装命令:
composer require imanaging-document/check-format-bundle
包简介
This bundle allows you to check format, and provide mapping file system
README 文档
README
This bundle is a tool that allows you to check arrays format.
You have to provide a structure, which describe the format you want to check, and the datas you want to check. It can be simple array, or array of array.
A mapping function is available inside this bundle, you have to implement some required interfaces to make it works. You will find more information about how to use it in this readme.
This bundle should be used inside an imanaging-document application.
Install the bundle with:
$ composer require imanaging-document/check-format-bundle
Configuration
You have to create a config/packages/imanaging_check_format.yaml file:
imanaging_check_format: bar: ~
This configuration is optionnal.
Check Format
Usage
You can access two statics methods named checkFormatFile and getObjLine where you need it in your project juste like this :
use Imanaging\CheckFormatBundle\CheckFormatFile; class MyBeautifulService { /** * ... */ public function myBeautifulFunction(...){ ... $result = CheckFormatFile::checkFormatLine($structureDescription, $myLineToCheckFormat)); ... } ... }
Examples
Checking a line structure
$structure = [ // Type, Column Name, Nullable new FieldCheckFormat("string", "Name", false), new FieldCheckFormat("integer", "Age", true), new FieldCheckFormat("integer", "Height", true), new FieldCheckFormat("string", "City", true), ]; $myLine = ['Rémi', '26', '170', 'San Francisco']; $result = CheckFormatFile::checkFormatLine($structure, $myLine)); // In this case, error equals false and the errors list is empty because there is no error // $result['error'] = false; // $result['errors_list'] = [];
Checking a file structure
$structure = [ // Type, Column Name, Nullable new FieldCheckFormat("string", "Name", false), new FieldCheckFormat("integer", "Age", true), new FieldCheckFormat("integer", "Height", true), new FieldCheckFormat("string", "City", true), ]; $lines = [ ['Rémi', '26', '170', 'San Francisco'], ['Antonin', '26', '181', 'Miami'], ]; $result = CheckFormatFile::checkFormatFile($structure, $lines)); // In this case, error equals false and the errors list is empty because there is no error // $result['error'] = false; // $result['errors_list'] = [];
Mapping
Requirements
- Symfony 4
- JQuery
- Bootstrap 4
- FontAwesome
Configuration
Interfaces
You have to implements the following interfaces in your config/packages/doctrine.yaml file :
Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationInterface: App\Entity\MappingConfiguration Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationTypeInterface: App\Entity\MappingConfigurationType Imanaging\CheckFormatBundle\Interfaces\MappingChampPossibleInterface: App\Entity\MappingChampPossible Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationValueAvanceFileInterface: App\Entity\MappingConfigurationValueAvanceFile Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationValueAvanceInterface: App\Entity\MappingConfigurationValueAvance Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationValueAvanceTextInterface: App\Entity\MappingConfigurationValueAvanceText Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationValueAvanceTypeInterface: App\Entity\MappingConfigurationValueAvanceType Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationValueInterface: App\Entity\MappingConfigurationValue Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationValueTransformationInterface: App\Entity\MappingConfigurationValueTransformation Imanaging\CheckFormatBundle\Interfaces\MappingConfigurationValueTranslationInterface: App\Entity\MappingConfigurationValueTranslation
Usage and examples
You can call a mapping page with an ajax call :
<div id="mappingDiv"> <div class="text-center mt-5"> <h4><i class="fa fa-spinner fa-spin fa-fw"></i>Chargement en cours ...</h4> </div> </div>
let data = {files_directory: '/public/database/attestation/fichier_client*.csv', next_step_route: 'hephaistos_administration_import_fichier_client', mapping_configuration_type: 'integration_client'}; $.ajax({ url: "{{ path('check_format_mapping_page') }}", type: 'POST', data: data, success: function (data) { $("#mappingDiv").html(data); }, error: function () { Toast.fire({type: 'error', title: 'Error'}); } });
imanaging-document/check-format-bundle 适用场景与选型建议
imanaging-document/check-format-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.5k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 05 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 imanaging-document/check-format-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 imanaging-document/check-format-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-03