Download the PHP package kodhe/validation without Composer

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

Kodhe Validation

Package validasi form hasil refaktor library Form_validation CodeIgniter 3, dengan namespace modern (Kodhe\Framework\Validation). Cocok dipakai untuk memvalidasi input POST/GET aplikasi CI3-style maupun standalone melalui set_data(). Menyertakan helper form (form_open, form_input, dll.) dan lapisan modular baru (factory validator, rule parser, message manager) di bawah src/.

Instalasi

Persyaratan: PHP >= 8.1. Helper validation/src/helpers/form.php di-autoload otomatis via composer.json (key files).

Quick Start

Catatan: tanpa instance CodeIgniter, run() membaca data dari $_POST. Gunakan set_data() untuk sumber data lain.

Struktur Direktori

Penggunaan

1. Validasi data non-POST (set_data)

2. Menampilkan error

3. Pesan error custom

Placeholder %s diganti dengan label field.

4. Repopulasi form (helper form)

set_value() / set_select() / set_radio() / set_checkbox() adalah method FormValidation yang membaca data POST terakhir agar form terisi ulang setelah gagal validasi.

5. Aturan (rules) bawaan

Kategori Rules
Umum required, regex_match[/.../], matches[field], differs[field], is_unique[table.field]*
String min_length[n], max_length[n], exact_length[n], alpha, alpha_numeric, alpha_numeric_spaces, alpha_dash
Angka numeric, integer, decimal, greater_than[n], greater_than_equal_to[n], less_than[n], less_than_equal_to[n], in_list[a,b,c], is_natural, is_natural_no_zero
Format valid_email, valid_emails, valid_url, valid_ip, valid_base64
Sanitasi prep_for_form, prep_url, strip_image_tags, encode_php_tags

* is_unique memerlukan koneksi database aktif.

Rules digabung dengan pipe: 'required|min_length[5]'.

6. Rule callback custom

7. Reset & cek rule

Konfigurasi

Konstruktor menerima array rules berformat CI3:

Atau menumpuk via set_rules($field, $label, $rules, $errors) seperti di Quick Start.

Referensi API (ringkas)

Method Keterangan
set_rules($field, $label, $rules, $errors) Daftarkan aturan per field
set_data(array $data) Ganti sumber data (default $_POST)
run($group = '') Jalankan validasi; return bool
error($field, $prefix, $suffix) Pesan error satu field
error_array() Semua error sebagai array
error_string($prefix, $suffix) Semua error sebagai string
set_message($lang, $val) Custom pesan per rule/field
set_error_delimiters($open, $close) Delimiter pembungkus error
set_value/set_select/set_radio/set_checkbox Repopulasi form
has_rule($field) / reset_validation() Introspeksi & reset

Kompatibilitas CodeIgniter 3

API FormValidation identik dengan CI_Form_validation CI3 — drop-in replacement. Perbedaan: nama kelas FormValidation (bukan Form_validation) dan namespace Kodhe\Framework\Validation. Jika dijalankan dalam aplikasi CI3, referensi CI internal tetap resolve ke instance CI sehingga is_unique dan helper form bekerja normal.

Catatan

Pengujian

Lihat tests/ untuk contoh pemakaian end-to-end.


All versions of validation with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 kodhe/validation contains the following files

Loading the files please wait ...