1. Go to this page and download the library: Download pitch/form 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/ */
pitch / form example snippets
namespace App\Controller;
use App\Form\MyFormType;
use Pitch\Form\Form;
class MyController
{
#[Form(MyFormType::class)]
public function __invoke($data)
{
// Just handle the data of a valid form.
// If the form is not submitted yet or the input is invalid,
// the controller will not be called and the
// Symfony\Component\Form\FormInstance will be returned.
}
}
namespace App\Controller;
use App\Form\MyFormType;
use Pitch\Form\Form;
use Symfony\Component\Form\FormInterface;
class MyController
{
#[Form(
MyFormType::class,
dataAttr: 'myData',
formAttr: 'myForm',
)]
public function __invoke(
Request $request,
FormInterface $myForm,
$myData,
) {
}
}
namespace App\Controller;
use App\Form\MyFormType;
use App\Form\MyFormEntity;
use Pitch\Form\Form;
class MyController
{
#[Form(
MyFormType::class,
entity: MyFormEntity::class,
)]
public function __invoke(MyFormEntity $data)
{
}
}
namespace App\Controller;
use App\Form\MyFormType;
use App\Form\MyFormEntity;
use Pitch\Form\Form;
class MyController
{
#[Form(
MyFormType::class,
entityFactory: 'myFactoryId',
)]
public function __invoke(MyFormEntity $data)
{
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.