lfbn/json-resume-validator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

lfbn/json-resume-validator

Composer 安装命令:

composer require lfbn/json-resume-validator

包简介

Validate your JSON Resume

README 文档

README

This is a package that validates if a Resume is in JSON Resume format. It also validates if any desired properties are not empty.

The validations that make are:

  • If complies with JSON Schema of JSON Resume.
  • It has certain fields filled in. This is configurable.
  • If the country code (basics.countryCode) is in ISO-3166-1 ALPHA-2 format. If this field is empty, is not validated.

Installing

composer require lfbn/json-resume-validator

Usage

As a CLI

Just clone the project, and run. Follow the instructions.

./bin/jr-validate

In your project

First, install it, using composer:

composer require lfbn/json-resume-validator

Then, create an instance, and call the isValid() method.

$path = 'json_resume.json';

$validator = Lfbn\JsonResumeValidator\JsonResumeValidator::load($path);

echo 'Is valid? '.$validator->isValid();

Encapsulate the isValid() method inside a try/catch. This method will return true if the file is valid or throws an exception if is not valid.

The name of the exception has the description of the error it has.

Your mandatory fields

You can, optionally, define the mandatory fields you want.

Just define them using dot notation.

$config = [
    'mandatory_fields' => [
        'basics.name',
        'basics.email',
        'basics.phone',
        'basics.summary'
    ]
];

$path = 'json_resume.json';
$resume = Lfbn\JsonResumeValidator\JsonResumeValidator::load($path, $config);

// It returns true, or it throws an Exception, is it fails in any Validation.
$resume->isValid();

Tests

This package has tests that use several JSON files to test if the behavior is as expected.

To execute them, just run:

composer tests

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固