teepluss/harvey
Larablocks Analysis
teepluss/harvey works with any PHP project: the latest release (v1.0, Aug 4, 2014) doesn't depend on Laravel.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- No release in the last 12 months (last: Aug 4, 2014)
- 0 downloads a month (needs 10,000)
- 2 GitHub stars (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Aug 4, 2014.
- No releases in the last 12 months.
- First released: Nov 1, 2013.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.
| Install | |
|---|---|
composer require teepluss/harvey |
|
| Latest Version: | v1.0 |
| PHP: | >=5.3.0 |
| License: | MIT |
| Last Updated: | Aug 25, 2014 |
| Links: | GitHub · Packagist |
Harvey is separate validation for Laravel 4
This is my internal project, not yet complete.
Installation
To get the lastest version of Theme simply require it in your composer.json file.
"teepluss/harvey": "dev-master"
You'll then need to run composer install to download it and have the autoloader updated.
Usage
class Blog extends \Teepluss\Harvey\Harvey {
/**
* Define rules.
*
* @type array
*/
public static $rules = array(
'description' => 'min:10|max:500',
'onCreate' => array(
'title' => 'required',
'url' => 'active_url'
),
'onUpdate' => array(
'title' => 'required'
)
);
/**
* Custom validation messages.
*
* @type array
*/
public static $messages = array(
'title.required' => 'Please fill title before submitting.'
);
/**
* Custom validation labels.
* @type array
*/
public static $lables = array(
'title' => 'Title'
);
/**
* Construct.
* @param array $attributes
* @return void
*/
public function __construct(array $attributes = array())
{
parent::__construct($attributes);
// Custom label.
$this->setLabelNames(array(
'title' => trans('labels.product'),
));
}
/**
* Event before validate.
*
* @return voide
*/
protected function beforeValidate()
{
$validator->sometimes('description', 'numeric', function($input)
{
return $input->title == 'tee';
});
}
}
This code for creating a new content.
$blog = new Blog;
$blog->title = 'New blog';
$blog->description = 'This is my first entry';
$blog->url = 'http://www.domain.com';
// Addition rule for another input.
$blog->addValidate(
array('other' => Input::get('other')),
array('other' => 'required|email'),
array('other.required' => 'sss')
);
if ( ! $blog->save())
{
$errors = $blog->errors();
return Redirect::back()->withErrors($errors)->withInput();
}
Validation rules for creating.
array(3) [
'description' => array(2) [
string (6) "min:10"
string (7) "max:500"
]
'title' => array(1) [
string (8) "required"
]
'url' => array(1) [
string (10) "active_url"
]
]
This code for updating an exists content.
$blog = Blog::find(1);
$blog->title = 'New blog';
$blog->description = 'This is my first entry';
$blog->url = 'http://www.domain.com';
$blog->save();
if ( ! $blog->save())
{
$errors = $blog->errors();
return Redirect::back()->withErrors($errors)->withInput();
}
Validation rules for updating.
array(2) [
'description' => array(2) [
string (6) "min:10"
string (7) "max:500"
]
'title' => array(1) [
string (8) "required"
]
]
Support or Contact
If you have some problem, Contact teepluss@gmail.com
Related Packages
Laravel 4/5 package that adds validator negation to Laravel's validation module
A Laravel custom validation package with some out of the box validators.
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| v1.0 | >=5.3.0 | MIT | |
| v0.1 | >=5.3.0 | MIT |
