This serves as an initial PHP integration within Form.io. The intent is to make this library not have any dependencies other than PHP to integrate within the Form.io API platform.
Single sign on (SSO) into Form.io from PHP
<?php
require_once('Formio.php');
$formio = new Formio('https://myproject.form.io', array(
'default_password' => '123testing'
));
// This token can now be used to authenticate into Form.io API Platform
print_r $formio->ssoToken('[email protected]');
?>
Login as an employee and create a resource.
<?php
require_once('Formio.php');
$formio = new Formio('https://myproject.form.io', array(
'resource' => 'employee'
));
$employee = $formio->login('[email protected]', '123testing');
// The employee object.
print_r($employee);
// The users token...
print $formio->token;
// This will now post using the Employee's auth token.
$resource = $formio->post('resource', array('data' => array(
'employee' => $employee['_id'],
'status' => 'opened',
'title' => 'TPS Report'
)));
print_r($resource['body']);
?>