1. Go to this page and download the library: Download glivers/roline 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/ */
glivers / roline example snippets
namespace Models;
/**
* Product Model
*
* Represents products in the catalog with stock tracking and timestamps.
* Manages product inventory, availability, and catalog operations.
*
* @author Your Name
* @copyright Copyright (c) 2026
* @license MIT License
* @version 1.0.0
*/
use Rackage\Model;
class ProductModel extends Model
{
// ==================== MODEL PROPERTIES ====================
/**
* Database table name for this model
*
* Defines which database table this model maps to. Used by the
* Query builder for all database operations on this model's records.
*
* @var string
*/
protected static $table = 'products';
// ==================== TABLE COLUMNS ====================
/**
* Unique product identifier
* @column
* @primary
* @autonumber
*/
protected $id;
/**
* Product name or title
* @column
* @varchar 255
*/
protected $name;
/**
* Stock quantity available
* @column
* @int
* @default 0
*/
protected $quantity;
/**
* When the product was added to catalog
* @column
* @datetime
*/
protected $created_at;
/**
* When the product details were last updated
* @column
* @datetime
*/
protected $updated_at;
// ==================== MODEL METHODS ====================
// Add your business logic methods here
}
return [
'author' => 'Your Name', // Appears in @author tags
'copyright' => 'Copyright (c) 2026', // Appears in @copyright tags
'license' => 'MIT License', // Appears in @license tags
'version' => '1.0.0', // Appears in @version tags
];
namespace Models;
/**
* User Model
*
* Represents authenticated users in the system.
* Handles user accounts, authentication, and profile data.
*
* @author Your Name
* @copyright Copyright (c) 2026
* @license MIT License
* @version 1.0.0
*/
use Rackage\Model;
class UserModel extends Model
{
// ==================== MODEL PROPERTIES ====================
/**
* Database table name for this model
*
* @var string
*/
protected static $table = 'users';
/**
* Enable automatic timestamp management
*
* @var bool
*/
protected static $timestamps = true;
// ==================== TABLE COLUMNS ====================
/**
* Unique user identifier
* @column
* @primary
* @autonumber
*/
protected $id;
/**
* User's full name
* @column
* @varchar 255
*/
protected $name;
/**
* Unique email address for login
* @column
* @varchar 255
* @unique
*/
protected $email;
/**
* Hashed password
* @column
* @varchar 255
*/
protected $password;
/**
* Account status flag
* @column
* @tinyint
* @default 1
*/
protected $is_active;
/**
* When the user registered
* @column
* @datetime
*/
protected $created_at;
/**
* When the user profile was last updated
* @column
* @datetime
*/
protected $updated_at;
}
namespace Controllers;
use Rackage\Controller;
use Models\UserModel;
class AuthController extends Controller
{
public function register()
{
UserModel::save([
'name' => 'John Doe',
'email' => '[email protected]',
'password' => password_hash('secret', PASSWORD_DEFAULT)
]);
}
public function getUsers()
{
$users = UserModel::where('is_active', 1)->all();
return $users;
}
}
/**
* Handle published action
*
* @return void
*/
public function getPublished()
{
View::render('posts.published');
}
use Rackage\Registry;
/**
* Add Status To Posts
*
* Migration: add_status_to_posts
* Created: 2025-01-15 14:30:22
*
* This migration was auto-generated by comparing your current database
* schema with the previous migration state.
*/
/**
* Run the migration (apply changes)
*/
function up()
{
$db = Registry::get('database-sync');
$query = $db->query();
$query->transaction();
try {
$db->execute("
ALTER TABLE posts
ADD COLUMN status VARCHAR(20) NOT NULL DEFAULT 'draft'
");
$query->commit();
} catch (Exception $e) {
$query->rollback();
throw $e;
}
}
/**
* Reverse the migration (rollback changes)
*/
function down()
{
$db = Registry::get('database-sync');
$query = $db->query();
$query->transaction();
try {
$db->execute("
ALTER TABLE posts
DROP COLUMN status
");
$query->commit();
} catch (Exception $e) {
$query->rollback();
throw $e;
}
}
// ❌ WRONG - Will be ignored by parser
protected static $username;
// ✅ CORRECT - Will create column
protected $username;
// ❌ WRONG - Terrible visual experience, hard to scan/edit
/** @column @varchar 255 @unique @index @comment "User email" */
protected $email;
// ✅ CORRECT - Each annotation on its own line
/**
* User email address for login
* @column
* @varchar 255
* @unique
* @index
* @comment "User email"
*/
protected $email;
// ❌ WRONG - No description, just annotations
/**
* @column
* @varchar 255
* @unique
*/
protected $email;
// ✅ CORRECT - Description explains the column's purpose
/**
* User email address for login and notifications
* @column
* @varchar 255
* @unique
*/
protected $email;
// ✅ ALSO GOOD - More detailed description
/**
* Order status in the fulfillment pipeline
* @column
* @enum pending,processing,shipped,delivered,cancelled
* @default pending
* @index
*/
protected $status;
/**
* User age (0-255 range is sufficient)
* @column
* @tinyint
* @unsigned
*/
protected $age;
bash
php roline model:table-create User
php roline model:table-update User
php roline model:table-schema User
php roline model:table-export User
bash
php roline db:export # Exports your entire database
php roline db:tables # Lists all tables
php roline db:create test_db # Creates a new database
bash
# ✅ RECOMMENDED - Just the name
php roline model:create User # Creates UserModel.php
php roline model:table-create User
# ✅ ALSO WORKS - With "Model" suffix (auto-stripped)
php roline model:table-update UserModel
# ✅ ALSO WORKS - Case insensitive
php roline model:create user
php roline model:table-update USER
# 💡 CONVENTION - Use PascalCase for readability
User, Post, Product, OrderItem (not user, post, product)