Download the PHP package rnr1721/le7-entify without Composer

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

le7-entify

Entify is entity framework for le7 PHP MVC framework or any PHP project

This project is a universal validator/converter. With it, it is possible to validate/normalize arrays. For example, you can use this project using the rules:

Requirements

Installation

Testing

Usage

  1. Create rules in a class or array.
  2. Create a DataProvider with Data
  3. Get the entity
  4. Get the verified entity

But it is basic usage. You can make more great things with Entify.

Rules in classes

For some reasons you may need to store rules in class, not in arrays. It great for storing rules for many-time usage from different places of your code. For example, we create file in namespaces Entities:

Thats all! Now we can use our rules. This example similar with previous example, but in this case we use rules model, not array:

DataProviders

By default you can use Array and Form providers in Entification class, but you can write own DataProviders (DataProviderInterface) or Renderers (EntityRendererInterface).

Rules

You can use many rules for validation and normalisation entities. Rules runs one-by-one, list of rules for each field is queue. For example, in this case filter 'filter' will run after 'convert'

Available filters

validate

This is validation filter. It uses le7-validator for validate, and you can read more about validation rules here: https://github.com/rnr1721/le7-validator

Required field. Can be: string

for example:

label

This is label (human-readable name) of field. You can use gettext functions such as _('My great label') for internationalisation. It used by validator, when it form errors messages, or you can use it when you render entity in future.

Required field. Can be: string

for example:

check

This filter used for own callable for check field. Callable can return true if succes, or string as error.

Not-Required field. Can be: false or callable

default

If field not exists in entity, it will be added and when you will get entity, field will be present with this default value

Not-Required field Can be: mixed

convert

Convert value to some data type

Not-Required field Can be: string (values: 'int', 'string', 'bool', 'float', 'double', 'bool')

for example:

hide

Hide value in entity. You will get entity without value

Not-Required field Can be: true or false

for example:

escape

Value will be escaped with htmlspecialchars() function

Not-Required field Can be: true or false

for example:

allowed

This filter will process value with strip_tags PHP function

Not-Required field Can be: null or string - second argument for strip_tags function

for example:

filter

This filter allow to process value with your own callable. Callable need return mixed value

Not-Required field Can be: callable

for example:

string, int, float, null, array, object, resource, callable

This filter will throw exception if value will not be some type

ot-Required field Can be: null or true

meta

Any meta information for your purposes

Not-Required field Can be: mixed

Entities

If you make entity from array, or form or write your own DataProvider, you need to know that DefaultHandler need these types of arrays:

If you use this type of array:

You will got the error.

Use options while got entity

Steps in Default Handler while array of data come from DataProvider to Entity: (this processes run in EntityHandlerDefault, method handle()):

  1. Check array format
  2. Standartization (Check if in entity present all fields in rules or for redundant fields)
  3. Validation (run validator for all entities)
  4. Filters (run filters)
  5. Remove hide ('hide') fields

In these example you can read how use some options:


All versions of le7-entify with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
psr/http-message Version ^2.0
rnr1721/le7-validator Version ^1.0
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 rnr1721/le7-entify contains the following files

Loading the files please wait ...