Download the PHP package makechtec/form-dispatcher without Composer

On this page you can find all versions of the php package makechtec/form-dispatcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package form-dispatcher

Ejemplos

Formulario

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example form</title>
</head>
<body>
    <form action="dispatcher.php" method="post">
        <input type="text" name="name" id="" value="">
        <input type="email" name="email" id="" value="">
        <button type="submit">Submit</button>
    </form>

        <script>
            alert("");
        </script>

        <script>
            alert("");
        </script>

</body>
</html>

Note que se coloca el autoload porque con esto tenemos acceso a la función session() que nos permite acceder a las variables de sesión colocadas en el despachador ya sea para recuperar errores u otros mensajes, además de la función dold() que sirve para recuperar los campos del formulario y evitar que vuelvan vacios. Esta función llama a echo() por lo que si se quiere solo el valor debe llamar a old().

Despachador

<?php 

use Facades\Mail;
use Facades\Database;
use Facades\Session;
use Facades\Template;
use Facades\ReCaptcha;

require_once(__DIR__ .'/../vendor/autoload.php');

Session::saveOlds();

try{

    $recaptcha = ReCaptcha::default()
                    ->error(function(){
                        throw new \Exception("Error ReCaptcha", 1);
                    })
                    ->check($_POST['input_recaptcha'], $_SERVER['REMOTE_ADDR']);

    $responseHTML = Template::render('mail.php', [ 'email' => $_POST['email'] ]);

    Mail::default("Mensaje de prueba")
        ->setTo($_POST['email'])
        ->setBody($responseHTML, 'text/html')
        ->send();

    Database::default()
        ->setTable('records')
        ->insert([
            'name' => $_POST['name'],
            'email' => $_POST['email']
        ]);
}
catch(\Exception $e){
    session('error', true);
    session('message', 'Ha ocurrido un error');
    back();
}

session('success', true);
session('message', 'exito');
back();

Se hace uso de las fachadas, como Mail que devuelve un objeto que extiende de __Swift_Mailer__ por lo que puede revisar la documentación correspondiente AQUI.

Para la fachada Template tiene un único méthodo estático que funciona para recuperar el contenido del archivo pasándole las variables mediante un array relacional como la función view() de Laravel.

Para Database se usa la siguiente libreria Nette Database.

Para la fachada de Session documentación pendiente.

Para Template utiliza el motor de Symfony Twig por lo que puedes ver su documentación AQUI.

Para ReCaptcha utiliza casi los mismo métodos que la libreria de Google ReCaptcha pero con unas modificaciones para que se pueda encadenar también la callback para error y éxito.


All versions of form-dispatcher with dependencies

PHP Build Version
Package Version
Requires nette/database Version ^3.1
swiftmailer/swiftmailer Version ^6.0
symfony/dotenv Version ^5.3
twig/twig Version ^3.3
google/recaptcha Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package makechtec/form-dispatcher contains the following files

Loading the files please wait ....