1. Go to this page and download the library: Download yohancayres/crud-advanced 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/ */
yohancayres / crud-advanced example snippets
use CrudAdvanced\DataBase;
use CrudAdvanced\Val;
use CrudAdvanced\Crud;
use CrudAdvanced\DataBase;
DataBase::configure('127.0.0.1', 'root', 'password', 'dbteste');
use CrudAdvanced\Val;
use CrudAdvanced\Crud;
class User extends Crud {
/* Database table definition */
public $table = "users"; // Define Table name
public $tableCols = ['name', 'email', 'password']; // Define table cols
/*
* Other class methods and attributes can be defined freely.
*/
}
$user = new User([
'name' => 'Yohan Cayres',
'email' => '[email protected]',
'password' => md5('somepassword')
]); // Create new object type User
$user->dbInsert(); // Insert at the Database
$user->dbLoadDataBy('email', 'id,name,password'); // Loads a database attribute by email.
echo $user->_get('id');
$user->_set('email', '[email protected]'); // This will set a new email
$user->dbUpdateAtts('email'); // Only the attribute 'email' will be updated
$user->dbUpdateAll(); // All the attributes will be updated
$user->dbUpdate('email', '[email protected]'); // Set and update directly.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.