PHP code example of contenir / formbuilder-laminas-mvc
1. Go to this page and download the library: Download contenir/formbuilder-laminas-mvc 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/ */
contenir / formbuilder-laminas-mvc example snippets
'Contenir\FormBuilder\Laminas\Mvc',
return [
'formbuilder' => [
// Service id of the Laminas\Db\Adapter\Adapter the loader
// and entry repository should consume. Defaults to the
// standard 'Laminas\Db\Adapter\Adapter' service name.
'db_adapter' => \Laminas\Db\Adapter\Adapter::class,
// Static values for {site:*} TokenReplacer expansion.
'site_context' => [],
// Service ids of additional submission observers (extra
// registrars) to attach beyond the built-in
// StoreSubmissionRegistrar. Add email / webhook /
// analytics registrars here.
'observers' => [],
],
];
use Contenir\FormBuilder\Laminas\Mvc\Loader\LaminasDbFormLoader;
use Contenir\FormBuilder\Service\FormBuilderService;
class FormController extends AbstractActionController
{
public function __construct(
private LaminasDbFormLoader $loader,
private FormBuilderService $builder,
) {
}
public function indexAction(): ViewModel
{
$definition = $this->loader->loadBySlug('contact');
$form = $this->builder->build($definition);
$isSuccess = $this->params()->fromQuery('form') === 'ok';
return new ViewModel([
'definition' => $definition,
'form' => $form,
'isSuccess' => $isSuccess,
]);
}
}
phtml
if ($isSuccess):
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.