PHP Object schema builder with validation and access control

dev-master 2018-03-27 12:54 UTC

This package is not auto-updated.

Last update: 2023-09-11 01:42:27 UTC


A simple to use and extendable php object schema library

Latest Stable Version License Build Status

Add to your project using composer


Via composer:

composer require sackrin/fission

Example Simple Usage

// Create a new Atom instance
// This will hold the object schema
$atom = Atom::create('person');

// Create some fields to be added to the schema
// These are called nucleus and describe schema properties
$nuclei = [
        ->label('First Name')

// Inject the nucleus instances into the atom
// The collective of nucleus is nuclei (just fyi)

// The reactor instance is used to react the atom schema with the nuclei against data
// This is where you will get a hydrated object tree of data
$reactor = Reactor::using($atom)

// Reactors will output a tree of isotopes using the with method
// Isotopes are the hydrated form of a nucleus instance and contain values
// Sanitization, Validation and Policy rules are applied to isotopes
// Press is a util class used to combine and supply data to the reactor instance
// You can just use a standard array if you like
$isotopes = $reactor->with(Press::values([
    'first_name' => ' John '

// Pass the isotope through the validator
$validator = Validator::validate($isotopes);

// Check if the validator has detected any errors
if ($validator->hasErrors()) {
    echo "Oh No, Failed Validation!";
    $errors = $validator->errors();
} // Otherwise if the validator passed 
else {
    // Using the Values walker you can scrape the data from the isotope tree
    // This will output a simple array tree representing the processed data
    $values = Values::gather($isotopes)->all();
    echo "Everything Validated!";
    $values = Values::gather($isotopes)->all();

More Examples

Refer to the examples folder for how to use fission