PHP code example of fyre / entity

1. Go to this page and download the library: Download fyre/entity library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fyre / entity example snippets


use Fyre\Entity\Entity;

$entity = new Entity($data, $options);

$entity->clean();

$entity->clear($fields);

$values = $entity->extract($fields);

$values = $entity->extractDirty($fields);

$values = $entity->extractDirty();

$values = $entity->extractOriginal($fields);

$entity->fill($data, $options);

$entity->fillInvalid($data, $overwrite);

$value = $entity->get($field);

$value = $entity->$field;
$value = $entity[$field];

$accessible = $entity->getAccessible();

$dirty = $entity->getDirty();

$errors = $entity->getError($field);

$errors = $entity->getErrors();

$hidden = $entity->getHidden();

$value = $entity->getInvalid($field);

$invalid = $entity->getInvalid();

$value = $entity->getOriginal($field);

$original = $entity->getOriginal();

$source = $entity->getSource();

$virtual = $entity->getVirtual();

$visible = $entity->getVisible();

$has = $entity->has($field);

$isset = isset($entity->$field);
$isset = isset($entity[$field]);

$hasValue = $entity->hasValue($field);

$hasErrors = $entity->hasErrors();

$isAccessible = $entity->isAccessible($field);

$isDirty = $entity->isDirty($field);

$isDirty = $entity->isDirty();

$isEmpty = $entity->isEmpty($field);

$isEmpty = $entity->isEmpty();

$isNew = $entity->isNew();

$entity->set($field, $value, $options);

$entity->$field = $value;
$entity[$field] = $value;

$entity->setAccess($field, $accessible);

$entity->setDirty($field, $dirty);

$entity->setError($field, $error, $ovewrite);

$entity->setErrors($errors, $overwrite);

$entity->setHidden($fields, $merge);

$entity->setInvalid($field, $value, $overwrite);

$entity->setNew($new);

$entity->setSource($source);

$entity->setVirtual($fields, $merge);

$array = $entity->toArray();

$json = $entity->toJson();

$json = (string) $entity;

$entity->unset($field);

unset($entity->$field);
unset($entity[$field]);

use Fyre\Entity\EntityLocator;

EntityLocator::addNamespace($namespace);

EntityLocator::clear();

$className = EntityLocator::find($alias);

$defaultEntityClass = EntityLocator::getDefaultEntityClass();

$namespaces = EntityLocator::getNamespaces();

$hasNamespace = EntityLocator::hasNamespace($namespace);

$removed = EntityLocator::removeNamespace($namespace);

EntityLocator::setDefaultEntityClass($defaultEntityClass);