diff --git a/README.md b/README.md
index ad4c3fb..27af97a 100644
--- a/README.md
+++ b/README.md
@@ -948,6 +948,12 @@ Field under this rule may be empty.
+string
+
+Field under this rule must be a string.
+
+
+
## Register/Override Rule
Another way to use custom validation rule is to create a class extending `Rakit\Validation\Rule`.
diff --git a/src/Rules/Stringy.php b/src/Rules/Stringy.php
new file mode 100644
index 0000000..0e9449d
--- /dev/null
+++ b/src/Rules/Stringy.php
@@ -0,0 +1,23 @@
+ new Rules\Defaults,
'default' => new Rules\Defaults, // alias of defaults
'nullable' => new Rules\Nullable,
+ 'string' => new Rules\Stringy,
];
foreach ($baseValidator as $key => $validator) {
diff --git a/tests/Rules/StringyTest.php b/tests/Rules/StringyTest.php
new file mode 100644
index 0000000..e70181b
--- /dev/null
+++ b/tests/Rules/StringyTest.php
@@ -0,0 +1,33 @@
+rule = new Stringy;
+ }
+
+ public function testValids()
+ {
+ $this->assertTrue($this->rule->check('foo'));
+ $this->assertTrue($this->rule->check('123asd'));
+ $this->assertTrue($this->rule->check('asd123'));
+ $this->assertTrue($this->rule->check('foo123bar'));
+ $this->assertTrue($this->rule->check('foo bar'));
+ $this->assertTrue($this->rule->check('
Lorem ipsum dolor sit amet cum omnis voluptatum!
'));
+ }
+
+ public function testInvalids()
+ {
+ $this->assertFalse($this->rule->check(2));
+ $this->assertFalse($this->rule->check([]));
+ $this->assertFalse($this->rule->check(new stdClass));
+ }
+}