Download the PHP package mkorkmaz/model_utils without Composer

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

ModelUtils

Circle CI Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality Codacy Badge

A simple PHP class for validating variable types, fixing, sanitising and setting default values for a model definition encoded as an array. Can be used before inserting or updating documents.

This class is experimental, the default behaviour won't be changed but probably has some bugs to be fixed and needs to be extended for different type of cases.

This class can be used as a part of a complete ORM/ODM or in some low level database operations scripts.

Model definition

_type:

To define variable type. Possible values: boolean, integer, float, string, array

_input_type:

To define more specific input type. Possible values: bool, date, time, datetime, timestamp, mail, url, ip, mac_address or regex

_input_format:

If _input_type is set to regex, value of document items will be tested against this expression.

_min_length:

To define minimum length if string, minimum value if integer or float

_max_length:

To \define maximum length if string, maximum value if integer or float

_required:

To define if required doc item. Not used in the class for now

_index:

To define if document item must be indexed in database. Not used in the class but can be used executing database operations.

_default:

To define default value for the document item.

_ref:

To define a relation with other documents like foreign key. Not used in the class but can be used executing database operations.

_has_many:

To define a relation with other documents that defined as child documents. Not used in the class but can be used executing database operations.

ModelUtils::validateDoc

You can use it to test the document. Can be used before inserting documents. Validation throws an exception if there is a conflict.

ModelUtils::fitDocToModel

Can be used for fixing and sanitising partial documents. Can be used before updating documents.

ModelUtils::setModelDefaults

Can be used for fitting partial document according to model definition. Can be be used before both inserting or updating documents.

Installation

It's recommended that you use Composer to install ModelUtils.

This will install ModelUtils and all required dependencies. ModelUtils requires PHP 5.4.0 or newer. crisu83/shortid package need to support short ids.

Usage

See also test.php

Contribute


All versions of model_utils with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
crisu83/shortid Version *
ezyang/htmlpurifier Version *
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 mkorkmaz/model_utils contains the following files

Loading the files please wait ....