PHP code example of geniv / nette-contact

1. Go to this page and download the library: Download geniv/nette-contact 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/ */

    

geniv / nette-contact example snippets


protected function createComponentContactForm(ContactForm $contactForm, IEmailEvent $emailEvent): ContactForm
{
    $contactForm->setTemplatePath(__DIR__ . '/templates/Contact/contactForm.latte');
    $emailEvent->setTemplatePath(__DIR__ . '/templates/Contact/email.latte');
    $emailEvent->getMessage()
        ->addTo('[email protected]');

    $contactForm->onSuccess[] = function (array $values) {
        $this->flashMessage('odeslano', 'success');
//            $this['flashMessage']->redraw();
    };
    $contactForm->onException[] = function (EventException $e) {
        $this->flashMessage($e->getMessage(), 'danger');
    };
    return $contactForm;
}
json
"php": ">=7.0",
"nette/nette": ">=2.4",
"geniv/nette-general-form": ">=1.0"