PHP code example of titon / model

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

    

titon / model example snippets


$user = User::find(1);
$user->username = 'foobar';
$user->save();

User::insert(['username' => 'foobar']);
User::select()->all();
User::deleteBy(1);
User::updateBy(1, ['username' => 'foobar']);

$users->hasOne('Profile', 'App\Repository\Profile', 'profile_id');

$entity = $users->select()->with('Profile')->where('id', 1)->first();