PHP code example of myschoolmanagement / bindto

1. Go to this page and download the library: Download myschoolmanagement/bindto library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

myschoolmanagement / bindto example snippets

 php

 Bindto\Binder;

$app = new Silex\Application();

$app->post('/feedback', function (Request $request) {

    $binder = Binder::createSimpleProductionBinder();
    $result = $binder->bind($request, CreateFeedback::class);
    if (!$result->isValid()) {
        throw new \Exception($result->getViolations());
    }
    $createFeedBack = $result->getData();
    mail($createFeedBack->subject, '[YourSite] Feedback', $createFeedBack->body);

    return new Response('Thank you for your feedback!', 201);
});

$app->run();