PHP code example of miladm / prototype

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

    

miladm / prototype example snippets





use miladm\Prototype;

class UserModel extends Prototype
{

}

use miladm\table\Connection;

class MainConnection extends Connection
{
    public $host = "127.0.0.1";
    public $databaseName = "sample";
    public $user = 'root';
    public $password = 'root';
}

class UserModel extends Prototype
{
    public function connection()
    {
        return new MainConnection;
    }
}

class UserModel extends Prototype
{
    public function connection()
    {
        return new MainConnection;
    }

    public function init()
    {
        // schema goes here
    }
}

    schema($name = false): Schema

class UserModel extends Prototype
{
    public function init()
    {
        $this->schema('user_data');
    }
}

    public function init()
    {
        $this->schema('user_data')->string('name')->string('family')->int('age');
    }

    public function init()
    {
        $this->schema('user_data')
            ->string('name')
            ->string('family')
            ->int('age')
            ->email('email')
            ->hash('password')
            ->boolean('verified');
    }