Download the PHP package yuanqing/kontact without Composer

On this page you can find all versions of the php package yuanqing/kontact. 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 kontact

kontact npm Version Packagist Version Build Status

An extensible contact form in PHP and vanilla JavaScript/AJAX.

Quick start

  1. Clone this repo into a location accessible via localhost. For example, do:

    Or simply upload this repo onto a web server that can run PHP.

  2. Open example/index.php on a web browser, break out your JavaScript console, and have a go at submitting the contact form.

Usage

Our contact form is composed of the following:

example/index.php

This is the HTML for the contact form itself.

  1. The js/dist/kontact.min.js and script.js JavaScript files are to be placed just before the closing body tag.

  2. The action attribute of the form is mail.php.

example/script.js

This is the JavaScript that sends the user input via AJAX to mail.php.

kontact(form, cb)

Listens to the submit event on the given form, and sends the user input for validation.

  1. form is a DOM element. User input is sent to the URL specified in its action attribute. (In our example, action is mail.php.)

  2. Form validation results are returned via the cb(err, data) callback. The value of err may be one of:

    • 0 — No error in user input.
    • array — There was an error in the user input. Each element in the array corresponds to a form field where there had been an error.

    data is an array containing the user input.

example/mail.php

This is the PHP script that processes the submitted form, and returns a response. It requires the file php/src/Kontact.php.

Kontact::__construct($schema, $cb)

Constructs a new Kontact instance.

  1. $schema is an array, with each element corresponding to a form field. The key is the name of the form field. The value is an array containing the following:

    • optional — Set to true if the form field can be empty. Defaults to false.
    • validate — A callable for validating user input. It must return false if the user input is invalid.
    • err — The error message (a string) that is returned if optional is false but the field was empty, or if the validate callaback returned false for the given user input.
  2. $cb is a callable that is passed the results of the form validation (namely, the $err messages and the user input $data). Do server-side stuff in $cb, eg. send email, or add $data to a database.

Kontact::process($input, $origin)

Validates the user $input. The user is redirected to $origin if the form was submitted with JavaScript disabled.

Installation

Install via npm:

Or via composer:

License

MIT license


All versions of kontact with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
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 yuanqing/kontact contains the following files

Loading the files please wait ....