PHPackages                             atayahmet/laravel-castable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. atayahmet/laravel-castable

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

atayahmet/laravel-castable
==========================

Clarify types of all inputs

v0.0.1(9y ago)626MITPHPPHP &gt;=5.5.5

Since Mar 2Pushed 9y ago1 watchersCompare

[ Source](https://github.com/atayahmet/laravel-castable)[ Packagist](https://packagist.org/packages/atayahmet/laravel-castable)[ Docs](https://github.com/atayahmet/laravel-castable)[ RSS](/packages/atayahmet-laravel-castable/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/6e9ee0ef6f47ffb307009f910d1bbb6a37d914d431246b129225325019e73f91/68747470733a2f2f7472617669732d63692e6f72672f6174617961686d65742f6c61726176656c2d6361737461626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/atayahmet/laravel-castable) [![Total Downloads](https://camo.githubusercontent.com/8e2e517df12c0358590cc9d1e5fc7fae13947543df771f45bdcb5653575d4c4e/68747470733a2f2f706f7365722e707567782e6f72672f6174617961686d65742f6c61726176656c2d6361737461626c652f646f776e6c6f616473)](https://packagist.org/packages/atayahmet/laravel-castable) [![License](https://camo.githubusercontent.com/9b559898ba1192d4810f3aa738ecd5a97903e63bff0c43dfddd3fabde6d846be/68747470733a2f2f706f7365722e707567782e6f72672f6174617961686d65742f6c61726176656c2d6361737461626c652f6c6963656e7365)](https://packagist.org/packages/atayahmet/laravel-castable) [![Latest Stable Version](https://camo.githubusercontent.com/cbd0a14a29b0e077073af358188acfe40616bd94b891a01005ce1df928e96b87/68747470733a2f2f706f7365722e707567782e6f72672f6174617961686d65742f6c61726176656c2d6361737461626c652f762f737461626c65)](https://packagist.org/packages/atayahmet/laravel-castable)

Laravel Castable
================

[](#laravel-castable)

**Laravel Castable** package is a type converter, input filter or sanitizer. It is possible to do all of these operations. Supported `POST`, `RAW DATA`, `GET` requests methods. We started by inspiring the Laravel Eloquent data cast.

Requirements
------------

[](#requirements)

PHP 5.6, 7.0+ Laravel 5.3 (LTS) or Laravel 5.4 (Current)

Get Started
-----------

[](#get-started)

Firstly, we install package:

```
$ composer require atayahmet/laravel-castable
```

and then we need add the service provider to the app.php

```
Castable\CastableServiceProvider::class
```

OK, we done.

Let's see how to use the laravel-castable.

### Castable types

[](#castable-types)

Typesstringintegerbooleanfloatdoublerealunsetarrayobject (stdClass)collectionCreate Castable Form Request class
----------------------------------

[](#create-castable-form-request-class)

We created new artisan command that inspired `make:request` from laravel built in command.

```
$ php artisan make:cast ContactRequest
```

**New form of the form request class:**

```
