PHP code example of nicolachoquet06250 / php-lib-orm

1. Go to this page and download the library: Download nicolachoquet06250/php-lib-orm 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/ */

    

nicolachoquet06250 / php-lib-orm example snippets




use PhpLib\ORM\Model;
use PhpLib\ORM\decorators\{
    Entity, Column, AutoIncrement, 
    PrimaryKey, DefaultValue,
    types\Integer, types\DateTime, 
    types\NotNull
};

#[Entity('table-name')]
class MaTable extends Model {
    #[
        Column('id'),
        Integer(11),
        AutoIncrement(),
        PrimaryKey()
    ]
    public int $id; 
    
    #[
        Column(),
        DateTime(),
        DefaultValue('NOW()'),
        NotNull()
    ]
    public string $created_at;
}