Download the PHP package songyz/laravel_validator without Composer

On this page you can find all versions of the php package songyz/laravel_validator. 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 laravel_validator

Songyz Laravel Validator扩展

解决痛点

安装配置

1、安装

执行 composer update 完成包加载。

2、加载服务

Laravel加载服务
找到 config/app.php 文件,在providers中添加以下代码

Lumen加载服务
打开bootstrap/app.php 添加以下服务提供

3、发布配置

Laravel 执行命令发布

Lumen 需手动发布

vendor/songyz/laravel_validator/src/config 找到 songyz_validator.php 复制到config目录下。
如果config目录不存在,手动创建即可。

发布完后,会在config目录下生成 songyz_validator.php 配置文件 至此项目配置完成。

使用方法

假设 创建一个User用户类,创建新增方法、更新方法,实现必要的验证

1、创建Controller文件及接口

再新创建Controller中新建两个方法:

2、创建验证器

执行成功后,在 app/Http/Requests/ 目录下看到UserRequest.php。
UserRequest.php,代码如下:

3、控制器方法与验证器类绑定- Laravel通过依赖注入实现

4、验证未通过抛出ValidatorFailureException异常

如果未通过验证,系统将抛出 ValidatorFailureException 异常。
可以在 exceptions/handle.php 捕捉。
例如: 开发接口项目:

5、示例演示

web.php 定义路由:

mobile格式错误 图片

add方法验证通过 图片

id通过验证 图片

补充异常

此功能可选择使用

打开app/Exceptions/Handler.php文件,将下面的代码替换原有的代码

新建ApiException


All versions of laravel_validator with dependencies

PHP Build Version
Package Version
Requires freelancehunt/php-credit-card-validator Version 3.*
php Version >=7.1
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 songyz/laravel_validator contains the following files

Loading the files please wait ....