PHPackages                             plasm/plasm - 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. plasm/plasm

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

plasm/plasm
===========

Schemas and Changesets for PHP

472PHP

Since Oct 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ryanwinchester/plasm)[ Packagist](https://packagist.org/packages/plasm/plasm)[ RSS](/packages/plasm-plasm/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (3)Used By (0)

Plasm
=====

[](#plasm)

[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/ryanwinchester/plasm/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/b6358f35b15850f6da51c643ab8b9e25307c72410b4139b69ca02d15dac84092/68747470733a2f2f7472617669732d63692e6f72672f7279616e77696e636865737465722f706c61736d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ryanwinchester/plasm)[![codecov](https://camo.githubusercontent.com/1c2dc3e9453b11b464d5d28a517124d752c8200849d376ae841ba147410dff9c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7279616e77696e636865737465722f706c61736d2e737667)](https://codecov.io/gh/ryanwinchester/plasm)[![Code Climate](https://camo.githubusercontent.com/174ca6d13a0398cb7a0abc03d844ffbeee0ea8aae10ba68f64f0f740d3d8c0a1/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7279616e77696e636865737465722f706c61736d2f6261646765732f6770612e737667)](https://codeclimate.com/github/ryanwinchester/plasm)

Filter, cast, and validate incoming data from **forms**, **API**s, **CLI**, etc.

Schema and Changeset for PHP are inspired by `Ecto.Changeset`from [Elixir's Ecto library](https://hexdocs.pm/ecto/Ecto.Changeset.html).

### In Development!

[](#in-development)

### Planned for V1.0:

[](#planned-for-v10)

- Default messages str replacements
- Finish default validators
- One or two provided Framework/ORM integrations
- Figure how to implement DB constraints from Integrations (unique, etc.)

Install
-------

[](#install)

Use [composer](https://getcomposer.org).

```
composer require plasm/plasm:dev-master@dev
```

Usage
-----

[](#usage)

### 1) Define a Schema:

[](#1-define-a-schema)

In the schema we specify all the fields we care about and specify what type we want them to be cast to.

Options:

- `type`: required. the type the field should be cast to
- `default`: Will default to this value if not present in changeset `$attrs`
- `virtual`: This will be a future to mark fields as not for storing

```
