承接 corealg/excel-validator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

corealg/excel-validator

Composer 安装命令:

composer require corealg/excel-validator

包简介

This package helps you to validate your excel sheet cell by cell. You do not need to store data blindly, you can rule each cell to match your expectation.

README 文档

README

Build Status License

This package helps you to validate your excel sheet cell by cell. You do not need to store data blindly, you can rule each cell to match your expectation.

Installation

Require this package with composer.

composer require corealg/excel-validator

Usage

<?php
// initilaize Core Excel Validator
$excelValidator = new ExcelValidator();

// make rules
$rules = [
    'first_name' => 'required',
    'last_name' => 'nullable',
    'email' => 'required|email|max:30',
    'joining_date' => 'date:Y-m-d'
];

// validate the sheet
$response = $excelValidator->validate($_FILES['file'], $rules);

// Success response
// [
//   "status" => "success"
//   "code" => 200
//   "errors" => []
//   "data" => [
//     1 => [
//       "first_name" => "Mizanur"
//       "last_name" => "Rahman"
//       "email" => "test@example.com"
//       "joining_date" => "2021-01-01"
//     ]
//   ]
// ]

// Validation error Response
// [
//   "status" => "error"
//   "code" => 422
//   "errors" => [
//      0 => "The First name is required at row 11"
//      1 => "The Joining date is not valid date format at row 18"
//      2 => "The Name is required at row 20"
//   ]
//   "data" => null
// ]

Creating Rules

Use column's name for your rule's index (all lower case and replace the black space with the underscore [_])

e.g. for column name First Name your rule will be

<?php 
$rule = [
    'first_name' => 'required'
];

Check this link to get the available validation rules: https://github.com/rakit/validation#available-rules

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Authors

License

MIT License

Copyright (c) 2021 CoreAlg

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固