PHP code example of fordnox / mikron

1. Go to this page and download the library: Download fordnox/mikron 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/ */

    

fordnox / mikron example snippets


    class Entity
    {
        /** @field */
        public $id;

        /** @field */
        public $name;

        /** Not a field */
        public $anything;
    }

    $mikron = new Mikron(new Pdo(...));
    $entity = $mikron->load('entity', 1);
    print $entity->id;
    print $entity->name;

    $entity->name = 'New Name';
    $mikron->store($entity); //updates entity name in DB

    $this->mikron->setNameResolver(function($type, $name) { return ucfirst($name); });