Sirius Input

Source Code Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Sirius Input is a framework agnostic PHP library for handling data coming to your application. It is suitable for forms, APIs (RESTful or not), CLI apps

Elevator pitch

$form = new \Sirius\Input\InputFilter();

$form->add('name', [
    'type' => 'text',
    'label' => 'Name',
    'rules' => ['required']
$form->add('email', [
    'type' => 'text',
    'label' => 'Email',
    'rules' => ['required', 'email']
$form->add('message', [
    'type' => 'textarea',
    'label' => 'Message',
    'hint' => 'Please write in detail the problem you are facing',
    'rules' => ['required']
$form->add('recaptcha', [
    'type' => 'recaptch',
    'label' => 'Are you human or are you dancer?'
$form->add('submit', [
    'type' => 'submit',
    'label' => 'Send request'


if ($form->isValid()) {
    // send message to admin, persist to database etc
} else {
    $view->set('errors', $form->getErrors());

The Sirius\Input depends on:

The Sirius\Input library doesn't render the forms for a few reasons:

  1. Single Responsibility Principle
  2. the library can be used for handling data coming from APIs. In this case a more appropriate render destination would be the API documentation
  3. different frameworks implement different ways to render things. Think about how to handle CSS/JS dependencies.

But because rendering forms is such a big part in any project we created Sirius\FormsRenderer as a starting base for such task.